开发者

Why can't I use shell_exec from a PHP script on a network share in IIS?

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 scr开发者_开发百科ipt 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


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜