views:

116

answers:

1

I have some PHP scripts that reside on a network share. For argument's sake, let's call the share \\nas\dev. I have a Web Site on \\w2k3dev\ set up in IIS6 that uses \\nas\dev\ as its home directory by setting "A share located on another computer".

Some of my scripts use shell_exec to execute functions on the server and return results to my script. Again for argument's sake let's say I'm just getting a directory listing like so:

echo shell_exec('dir');

  • If I run the script in IIS, I get no output - but no error logs either.
  • If I set up Apache on \\w2k3dev\ and configure it to use the same share, the script runs fine
  • If I copy the script to the local machine and run it through IIS it works fine.

So the problem only seems to be when IIS is set up to use a network share with a script containing shell_exec. Every other aspect of my scripts work fine.

Profiling in procmon, I can see that cmd.exe operates completely differently depending on whether it's being run by IIS or Apache. I have more details, but for the sake of being concise, I will omit them for now unless someone asks for more details.

Thank you so much for looking at this, I am at my wits end.

Kind regards

Iain

+1  A: 

You may have a look at those IIS specific comments on php.net shell_exec's manual :

http://www.php.net/manual/en/function.shell-exec.php#84992

http://www.php.net/manual/en/function.shell-exec.php#70817

http://www.php.net/manual/en/function.shell-exec.php#70338

http://www.php.net/manual/en/function.shell-exec.php#43907

Benjamin Delichère
Thanks for the answer Benjamin. I have looked at these comments previously - but I took another look in case I missed something and I've tried all of those suggestions. I'll wait a while and see if anyone else answers and I'll award you the answer if I don't get anything else - your answer might not solve my particular problem, but it might help someone else in a similar situation as me.Cheers mateIain
Iain Fraser