Solved

PHP call program by exec on Linux

Posted on 2007-03-25
4
571 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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

Suggested Solutions

The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
This article discusses how to create an extensible mechanism for linked drop downs.
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…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

749 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