Trying to call a Windows XP application through PHP

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Trying to call a Windows XP application through PHP

Postby 137th Gebirg » 07. December 2007 16:37

Hello all:

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.
137th Gebirg
 
Posts: 14
Joined: 07. December 2007 16:21

Postby 137th Gebirg » 12. December 2007 15:25

Anyone?
137th Gebirg
 
Posts: 14
Joined: 07. December 2007 16:21

Postby Wiedmann » 12. December 2007 15:53

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.

The desktop interaction is disabled for the Apache service (Windows service manager).

BTW:
Why want you see this program? It's started on the server and not on the client pc (the one which request this php script)?
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby 137th Gebirg » 12. December 2007 16:31

For the particular requirements I'm working with, all applications, the web server and everything else must reside on the same machine, accessible via Remote Desktop Connection. Believe me, this isn't the ideal setup by any stretch, but it is what I have to work with.

And THANK YOU, THANK YOU, THANK YOU! I found the interactive desktop setting and it's all working now. I knew there had to be a simple answer out there.
137th Gebirg
 
Posts: 14
Joined: 07. December 2007 16:21

Postby 137th Gebirg » 15. January 2008 16:41

Well, I now have a follow-up question to this thread.

I moved the system over to its final resting place from Windows XP to Windows 2003 Server and I'm having this problem again! I turned on the "Allow service to interact with desktop" check box in the Apache service preference like I did in XP that made it work originally, and the same old thing happens - application gets called, runs in the background and doesn't actually get invoked to the desktop. I know that Windows 2003 has a bunch of extra security "features" that prevents a lot of stuff from happening out of the box and this is likely one of them - some additional setting that needs to be activated elsewhere. Is there some other service that exists in 2003 and not XP that also needs to "interact with the desktop" in order for this to function properly?

What am I missing? I'm not a Windows admin and this stuff genuinely mystifies me. Any help appreciated. Thank you!
137th Gebirg
 
Posts: 14
Joined: 07. December 2007 16:21

Postby 137th Gebirg » 04. February 2008 19:41

Solution found, for anyone interested. The shortcut for Remote Desktop Connection that I'm using to access the Windows 2003 server remotely required a "/console" parameter following the shortcut link string. This allows applications to be invoked if a user is running RDC. If I was logging directly into the machine, I would not have had this issue.
137th Gebirg
 
Posts: 14
Joined: 07. December 2007 16:21


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 129 guests