Solved

PHP call program by exec on Linux

Posted on 2007-03-25
4
567 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
Comment Utility
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
Comment Utility
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
Comment Utility
Forced accept.

Computer101
EE Admin
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
The viewer will learn how to count occurrences of each item in an array.
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…

728 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now