PHP shell_exec times out, but not when executed manually

Posted by Breck Fresen on Server Fault See other posts from Server Fault or by Breck Fresen
Published on 2010-04-22T04:14:52Z Indexed on 2010/04/22 4:23 UTC
Read the original article Hit count: 306

Filed under:
|
|

I have a Windows 2008 server with PHP and msys installed. I also have a simple php script that calls shell_exec and tars a few files. When I run the script on my development machine (Windows 7), it works fine. However, when I run it on the Windows 2k8 server, it times out. When I copy and paste exactly what's being run on the cmd line and run it, it executes w/out error in less than a second.

One more important detail: when I shell_exec 'dir' or 'netstat', the script runs without any problems. When I shell_exec 'ls' it hangs. When I run ls on the command line, it returns immediately.

Other details that might be useful: The Windows 2k8 server is a VPS hosted by Rackspace. I did vanilla installs of Apache, PHP, and msys, but I haven't installed anything else.

When I run whoami, I see the php script is executing as the user "nt authority\system".

© Server Fault or respective owner

Related posts about php

Related posts about Windows