Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

PHP call program by exec on Linux

Posted on 2007-03-25
4
Medium Priority
?
580 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 1000 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.
Suggested Courses

886 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