tags:

views:

219

answers:

1

I have installed PHP as a module in IIS on Windows Server 2008, am am having great difficulty trying to execute command-line programs from within a PHP script.

I can execute the PHP code fine using php-cgi.exe and php-cli.exe, which leads me to believe that it might be a permissions issue.

However, I can execute some commands, like shutdown.exe and dir.

I have tried the same process in an ASP.NET file and am having exactly the same problem.

Basically, I would like to do this:

exec("path-to-exe-file");

And actually have it work.

A: 

Try

exec('path-to-exe-file 2>&1', $output);
var_dump($output);

The 2>&1 part should redirect error messages to stdout (on win32, too) which therefore should show up in $output.

VolkerK