One of my PHP scripts is designed to call an application as a command-line invocation. The app loads successfully, but only in the background. I see it listed as a running process in the Windows Task Manager, but the window containing the app I'm calling doesn't ever actually appear. Here's a snippet of code that I'm using. As an example, I'm trying to bring up a new instance of FireFox:
- Code: Select all
$path = "C:\\progra~1\\mozill~1";
$file = "\\firefox.exe";
chdir($path);
$call = $path.$file;
pclose(popen('start '.$call.'', 'r'));
This problem occurs for any kind of call to a Windows app. The weird thing is, if I echoed the $call string, which would look like this once concatenated and printed to STDOUT:
C:\progra~1\mozill~1\firefox.exe
...copied and pasted back into a command line, it behaves perfectly, bringing up an instance of Firefox.
I'm pretty sure this is some kind of security feature within Apache and/or PHP which prevents a script from highjacking the operating system locally by invoking hidden viruses/worms/trojans, etc. Normally, I would consider this a very good thing and wouldn't think twice about its usefulness in protecting machines and users. However, in the particular application I'm working on, I do need to be able to call new Windows apps from a PHP script in this manner (or any other that may suffice). Is there some quick & dirty configuration setting out there that I can tweak to get this to work?
Any assistance appreciated.