Iain Fraser
Iain Fraser

Reputation: 6738

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');

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

Upvotes: 0

Views: 838

Answers (1)

Related Questions