Solved

PHP call program by exec on Linux

Posted on 2007-03-25
4
570 Views
Last Modified: 2008-03-25
I have a php program running on CentOS and require to call firefox using exec for plug-in activities, however it seems the system did nothing while calling the command by exec (e.g. exec("firefox -saveimage http://www.yahoo.com")), I'm sure the command can run thru terminal, is it related to rights issue?

I have find some documents about "sudo" but no help... can you guys help to list out a detailed steps for such setting? Thanks a lot!
0
Comment
Question by:adidaz
4 Comments
 
LVL 19

Expert Comment

by:BrianGEFF719
ID: 18789335
You need to specifiy the full path:

exec("/usr/sbin/firefox -saveimage http://www.yahoo.com");
0
 
LVL 48

Accepted Solution

by:
hernst42 earned 250 total points
ID: 18792327
firefoy is unable to start and execute any command if there is no X-Display reachable. You will either need to run a local xserver and enable the localhost to connect to the X-Server so firefox can contact that screen. The run the the command like:
exec("DISPLAY=:0.0 /usr/sbin/firefox -saveimage http://www.yahoo.com");


replace :0.0 with the correct display no
0
 
LVL 1

Expert Comment

by:Computer101
ID: 21207270
Forced accept.

Computer101
EE Admin
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question