LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-07-2010, 08:34 PM   #1
vaporizel
LQ Newbie
 
Registered: Jan 2006
Distribution: Slackware 10.0
Posts: 23

Rep: Reputation: 0
how do i run firefox using exec() in php?


I can run firefox in PHP CLI using this code

Code:
exec("DISPLAY=:0.0 firefox");
but when i run it in BROWSER it didnt give same result, firefox didnt show, even in process.

I'm using Centos 5.4 32-bit

Last edited by vaporizel; 11-07-2010 at 10:02 PM.
 
Old 11-09-2010, 05:46 AM   #2
pgpython
Member
 
Registered: Dec 2005
Location: Sheffield, UK
Distribution: Gentoo
Posts: 142

Rep: Reputation: 32
I think your slightly confused here. When you ran Firefox from the cli you ran it from the machine you were running it on. however if you put that command on a web page. that does not get executed on the client! What happens is the client will request that page and execute on the server. which is a dangerous thing to do and should be only done if necessary and under the tightest security and also is unsuitable for running any GUI commands. so putting exec("DISPLAY=:0.0 firefox") is completely wrong.

So the question you ask is how do you execute the command on the client then?

The answer is you can't under normal circumstances. Fortunately for opening a window you don't need to . you can use the window.open function in javascript. which will open a new browser window or use the target attribute on links

Be careful if you use window.open though, many browsers will block this as its considered to be annoying popup
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP: can't exec some programs when run through apache. why? BrianK Programming 3 09-20-2007 04:10 PM
Help using exec() with php to run BitTornado linux nsdothack Linux - Software 0 03-18-2007 05:33 PM
php: exec can't run lynx after apache restart BrianK Programming 4 01-16-2006 05:47 PM
PHP / VideoLAN / Fedora Core Question - how can I get the PHP "exec" function to work gtrawoger Linux - Software 3 12-21-2005 06:51 AM
PHP exec Spooky Programming 1 01-19-2004 08:34 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:53 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration