• 0

PHP exec


Question

Hi guys,

i'm getting really frustrated with PHP at the moment... i'm only a newbie but i've been desperately trying to get an exec command to work for more than 4 hours now! :crazy:

Anyway.... i am running PHP5 on a WinXP machine using IIS. What i want the script to do is to execute a command that starts a program on the server and doesn't wait for the program to finish... not too hard i would think... but no matter what i do the program doesn't run or the script hangs waiting for the program to exit. I have looked all over the net for tutorials and help but nothing seems to work.

Please help!

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

A couple of things things you can try.

One is to use COM and the WScript.Shell object to start the process, but this is only going to work if COM support is compiled in with / enabled in PHP which I believe is an optional extension. Someone feel free to correct me if this is wrong.

To use COM to do this you would have to do something like this:

$WshShell = new COM("WScript.Shell");
$WshShell->Run("explorer.exe", 5, false);

Two and probably by far the easiest is to use ye olde start command that is built into Windows, i.e.:

<?php exec('start c:\windows\explorer.exe'); ?>

I'm not sure if either of these will accomplish what you need though and allow the application to be visible on your desktop. To get that to work I think you'll have to change the IIS service so that it runs under your user account rather than the "LOCAL SERVICE" account.

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.