|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-07-08 18:58 UTC] sniper@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 16:00:01 2025 UTC |
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 . . . . .