From: fskbcb at puk dot ac dot za Operating system: Windows XP PHP version: 5.2.3 PHP Bug Type: Network related Bug description: Dir function unable to view shared folders
Description: ------------ I am unable to access a shared directory on another windows pc by executing the windows "dir \\remoteserver\sharedir" function in php. I have tried this using exec(),system() etc. When I type the command "dir \\remoteserver\sharedir" on the windows command line (cmd) it works fine. If I do a "dir \\ownserver\sharedir" of the shares of the pc that I am working on, I am able to view them. It seems that when php executes the command to read another pc's shares, there may be permission problems? Reproduce code: --------------- <?php /* Please change server name and directory name to relevant windows share */ $server_name="radio"; $server_name="radio"; $directory_name="photos"; $share="\\\\".$server_name."\\".$directory_name; $cmd=array( "net use ".$share, "dir ".$share); for ($x=0;$x < count($cmd);$x++) { echo "Command: ".$cmd[$x]." <br>"; $result = `$cmd[$x]`; echo "The result is: <br>".$result." <br>"; } ?> Expected result: ---------------- Command: net use \\radio\photos The result is: Local name Remote name \\radio\photos Resource type Disk Status OK # Opens 0 # Connections 1 The command completed successfully. Command: dir \\radio\photos The result is: Actual result: -------------- Command: net use \\radio\photos The result is: Local name Remote name \\radio\photos Resource type Disk Status OK # Opens 0 # Connections 1 The command completed successfully. Command: dir \\radio\photos The result is: Volume in drive \\radio\photos is Spare Volume Serial Number is 4C41-9557 Directory of \\radio\photos 05/07/2007 06:13 PM <DIR> . 05/07/2007 06:13 PM <DIR> .. etc . . . . . -- Edit bug report at http://bugs.php.net/?id=41926&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=41926&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=41926&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=41926&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=41926&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=41926&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=41926&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=41926&r=needscript Try newer version: http://bugs.php.net/fix.php?id=41926&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=41926&r=support Expected behavior: http://bugs.php.net/fix.php?id=41926&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=41926&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=41926&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=41926&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=41926&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=41926&r=dst IIS Stability: http://bugs.php.net/fix.php?id=41926&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=41926&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=41926&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=41926&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=41926&r=mysqlcfg