Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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".

share|improve this question
Have you checked permissions to make sure the System account can access all of the necessary folders? – Matthew Apr 22 '10 at 13:20

It most likely is permissions or an environment variable. If you are using any environment variables in your script double-check that they are also set when run via cron, as the environment vars are often not the same as they are for your normal login shell.

If its not environment, just start double checking permissions.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.