NameInUse Posted October 3, 2008 Share Posted October 3, 2008 I've asked about this problem in countless places, but I cannot seem to find any help. So please, contribute in any way you can. If you don't know the answer, please let me know where I can find out. I'm trying to use a PHP script to properly run Firefox. Here's what I've tried and discovered: <?php exec('firefox'); ?> This runs Firefox, but I get the error "XULRunner Error: "Couldn't read application.ini". Now, I know the application.ini file is there and working. I can execute the Firefox executable perfectly through Windows Command Prompt. So, its a problem with the how the script is accessing the Firefox executable. If you are having any doubts, the following code opens and runs notepad perfectly: <?php exec('notepad'); ?> This proves that it is an isolated problem with Firefox and how its being accessed by the PHP script. It also proves that GUIs can be run by the exec function. Anyone who finds a solution, or at least sets me on a proper path, I bow down to you! Thanks in advance. Feel free to ask me any questions. Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted October 3, 2008 Share Posted October 3, 2008 Read about the "-app path/to/application.ini" command line parameter at this link http://developer.mozilla.org/en/Command_Line_Options on how to specific the .ini file. Quote Link to comment Share on other sites More sharing options...
xtopolis Posted October 3, 2008 Share Posted October 3, 2008 *above post is better* Quote Link to comment Share on other sites More sharing options...
NameInUse Posted October 3, 2008 Author Share Posted October 3, 2008 Read about the "-app path/to/application.ini" command line parameter at this link http://developer.mozilla.org/en/Command_Line_Options on how to specific the .ini file. Thanks for helping, but I'm getting another error now. At least its progress! I tried out <?php exec("firefox -app C:/WINDOWS/application.ini"); //note that I put all the Firefox files in the Windows folder without a subdirectory ?> and now I get the error: XULRunner Error: Platform version " is not compatible with minVersion >= 1.9.0.2 maxVersion <= 1.9.0.2 I'm not sure whats wrong. I'm using Firefox 3.03... Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted October 3, 2008 Share Posted October 3, 2008 Because of all the registry entries that any Windows application relies on, you cannot just "move" its' files. Put the files back where they are supposed to be and specify the full file system path to the .exe in the exec() statement. Use double back-slashes \\ in your path. Quote Link to comment Share on other sites More sharing options...
NameInUse Posted October 3, 2008 Author Share Posted October 3, 2008 Because of all the registry entries that any Windows application relies on, you cannot just "move" its' files. Put the files back where they are supposed to be and specify the full file system path to the .exe in the exec() statement. Use double back-slashes \\ in your path. OK, I tried this: <?php exec("C:\\Program Files\\Mozilla Firefox\\firefox.exe -app C:\\Program Files\\Mozilla Firefox\\application.ini"); ?> but nothing is happening. Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted October 3, 2008 Share Posted October 3, 2008 What are you expecting it to do? Please read the other command line options at the above link. Unless you specific what you want it to do, it will just load and unload. Quote Link to comment Share on other sites More sharing options...
NameInUse Posted October 3, 2008 Author Share Posted October 3, 2008 What are you expecting it to do? Please read the other command line options at the above link. Unless you specific what you want it to do, it will just load and unload. I'm expecting it to load. In the above script I showed, Firefox isn't even being executed. Nothing happens at all. Quote Link to comment Share on other sites More sharing options...
trq Posted October 3, 2008 Share Posted October 3, 2008 What on earth do you actually want this for? Quote Link to comment Share on other sites More sharing options...
NameInUse Posted October 3, 2008 Author Share Posted October 3, 2008 What on earth do you actually want this for? I'm going to be sending arguments to a Firefox add-on. The reasoning is a bit complex and I don't want to explain it all. I do need to do this, however, so it isn't trivial. Quote Link to comment Share on other sites More sharing options...
NameInUse Posted October 3, 2008 Author Share Posted October 3, 2008 I discovered that nothing works when I specify the file path. Any idea why? Quote Link to comment Share on other sites More sharing options...
predsednik Posted July 17, 2011 Share Posted July 17, 2011 just change dir chdir('C:\Program Files\Mozilla Firefox'); and than shell_exec("firefox.exe") or exec("firefox.exe") Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.