Jump to content

The exec function and Firefox -- Please save the day!


NameInUse

Recommended Posts

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.

Link to comment
Share on other sites

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...

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 2 years later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.