Friday, 23 August 2013

PHP shell_exec using UNC paths

PHP shell_exec using UNC paths

In PHP, I can not execute a command via shell_exec, system, or exec, when
using unc paths. Here is an example:
What works:
$command = shell_exec("dir c:\\"); echo $command;
Here is what does not work. It echo's nothing.
$command = shell_exec("dir \\\\server\\dir"); echo $command;
When I run dir \\server\dir in the Windows Command window or PowerShell it
executes fine.

No comments:

Post a Comment