LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-18-2009, 07:38 AM   #1
Mike123456
LQ Newbie
 
Registered: Jul 2009
Posts: 4

Rep: Reputation: 0
How to execute firefox on linux from a php script?


Hello,
I would like to have a php script that will start firefox on the server where it's running. I need this because I am using a command on firefox to create thumbnail for the opened page.

Currently, if i am using this command from the command line, it is working: "/usr/lib/firefox-3.0.7/firefox -savepng http://www.site-name.com/ --display=:0.0" and firefox generates my thumbnails and saves it.

If I execute the same command above using shell_exec from php, nothing happens and the returned value from shell_exec is NULL.

I tried giving the php script 777 permision, changed owner to root, nobody, still nothing.

What must I do in order to make a php script to execute firefox?
 
Old 07-18-2009, 12:27 PM   #2
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 332Reputation: 332Reputation: 332Reputation: 332
This sounds a lot like a recipe for a remote execution attack.
 
Old 07-19-2009, 04:33 AM   #3
Mike123456
LQ Newbie
 
Registered: Jul 2009
Posts: 4

Original Poster
Rep: Reputation: 0
Hi,
No, no, I can assure you, I'm not interested in atacking no one.

I told in the first post, I want to be able to generate thumbnails for a given URL. And I want this thing to be put on my server, so I can call it from my site. I know about the free/paid services like browsershots and others, and they are great, but i need a fast service and simple service just for my site.

So, I found some resources and articles (i don't know if i'm allowed to post an external link here) to an addon for mozilla firefox that can be installed on linux too and called from the command line. And this command (/usr/lib/firefox-3.0.7/firefox -savepng http://www.site-name.com/ --display=:0.0) starts firefox in the first display, loads the url provided, takes a snapshot of the whole page, saves it in the folder where firefox is configured to save the downloads and then closes the browser.

I have tested this from the command line directly on the server and it worked and from the command shell application in webmin administration panel and it works too. Now, all i need is to make it work from php (or perl, cgi, if needed, but i need to intergrate it eventualy in php.

I've read about shell_exec, exec, pastrhough, and so, but no luck.
I've tried giving the php script other users or group, I even gave firefox on my server the user apache, nothing happened, i can't make the above command to work from php.

Please help.
 
Old 07-25-2009, 03:09 AM   #4
Mike123456
LQ Newbie
 
Registered: Jul 2009
Posts: 4

Original Poster
Rep: Reputation: 0
Bump.
Is there no one who can help me? No one knows linux here so he/she could help me?
Please, i need help.
 
Old 07-25-2009, 03:24 AM   #5
alpha01
Member
 
Registered: Jul 2008
Location: Orange County
Distribution: Ubuntu/Debian, CentOS, RHEL, FreeBSD, OS X
Posts: 75

Rep: Reputation: 19
Have you tried using the back tics? (`firefox`).

You mentioned that you have a command on firefox to create thumbnail for the opened page. Have you tried at cURL/lib to see if you can accomplish this without the need of firefox?
 
Old 07-26-2009, 05:29 AM   #6
Mike123456
LQ Newbie
 
Registered: Jul 2009
Posts: 4

Original Poster
Rep: Reputation: 0
Hello,
I tried using the backticks but it had no effect, so I searched on php.net for backticks and there it says that they provide the same effect as shel_exec() does, so since shell_exec() doesn't do what i want to do (as you can see in my first post), niether the backticks work.

I searched for a cURL/lib something that could help me, but the only things i got were just examples of how to use cURL to generate a thumbnail for a website using one of the already existing web-services that do that. But this isn't what i want, I need to have my server setup so I can call it from my site and generate the thumbnails.

Please help and advise.
mike.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP Script Does Not Execute Ukee Linux - Server 5 02-24-2008 09:00 PM
execute php script by a time () afbase Linux - General 1 12-30-2006 04:30 PM
Execute shell script using php on linux vj123 Programming 2 02-21-2006 01:41 AM
How to Execute PHP Script? notooth Linux - General 2 06-02-2005 06:43 AM
PHP -- How to execute a shell script from PHP using FTP functions?? zoonalex Programming 3 07-29-2004 12:51 PM


All times are GMT -5. The time now is 03:46 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration