Solved

PHP call program by exec on Linux

Posted on 2007-03-25
4
574 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

Question has a verified solution.

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

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
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 …

724 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