php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #22153 Trouble accessing network drives with opendir()
Submitted: 2003-02-10 15:50 UTC Modified: 2003-02-13 10:08 UTC
From: cstreeter at andesagroup dot com Assigned:
Status: Not a bug Package: Directory function related
PHP Version: 4.3.1-dev OS: Win2K
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: cstreeter at andesagroup dot com
New email:
PHP Version: OS:

 

 [2003-02-10 15:50 UTC] cstreeter at andesagroup dot com
This code:

if ($dir = opendir( $dirPath ) ) {
  while ( ( $file = readdir( $dir ) ) !== false) {
    echo "$file\n";
  }  
  closedir( $dir );
}

Give me this error:

Warning: opendir(i:\templates) [function.opendir]: failed to open dir: Invalid argument in C:\www\AndesaNet\function_library.php on line 298

I: is a UNC mapped drive and i:\templates is a network folder that I have full access to. I can read, write, change and delete files here both from a DOS prompt and from Windows Explorer.

I am running PHP as a module on Apache2 (win bianaries)

Is this a known bug?

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-02-13 07:45 UTC] iliaa@php.net
I've ran a few tests on Windows XP using the latest PHP.

First of all PHP can open networked drives, however it can do so when you specify the network share speficially, for example:
opendir("\\\\my.ip\\my_dir");
Also, the access to the drive needs to be previously authenticated, so the auth process need not be done by PHP, which cannot do it. Meaning that in my tests it only worked if I opened the network drive manually first using explorer and supplied to proper credentials (login & password), which the system then used automatically for all future connections.
 [2003-02-13 10:05 UTC] cstreeter at andesagroup dot com
Kind and Helpful PHP dudes and dudettes:

My Bad. Once I set the permissions on the share to "Everyone" the problem went away. I had them only set for my ID (which I was using to connect to the drives) but apprently, that wasn't getting resolved by Apache.

SO - To anyone who needs to use UNC mapped drives with OpenDir(), if you are having a problem with OpenDir() reading the directory, check your permissions for the share on the host machine. Start with giving full permission to everyone (which should work fine) and then back accessability until you have a problem.

Please consider this issue closed for my account. Thank you.

Hope this helps others.

Chris
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Nov 24 00:01:27 2024 UTC