php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41927 Dir function unable to view shared folders
Submitted: 2007-07-08 18:45 UTC Modified: 2007-07-08 18:51 UTC
From: fskbcb at puk dot ac dot za Assigned:
Status: Not a bug Package: Network related
PHP Version: 5.2.3 OS: Windows XP
Private report: No CVE-ID: None
 [2007-07-08 18:45 UTC] fskbcb at puk dot ac dot za
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: 
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 . . . . .

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:

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-07-08 18:51 UTC] derick@php.net
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

Dup of #41926.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 22:01:30 2024 UTC