php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41926 Dir function unable to view shared folders
Submitted: 2007-07-08 18:43 UTC Modified: 2007-07-08 18:58 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:43 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: 


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 . . . . .

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-07-08 18:58 UTC] sniper@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.


 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Thu Jun 20 05:01:26 2019 UTC