ID: 25805 Updated by: [EMAIL PROTECTED] Reported By: mattj at exitcare dot com -Status: Open +Status: Feedback Bug Type: Directory function related Operating System: Windows 2003 Web Server PHP Version: 4.3.3 New Comment:
Try renaming those shares not to have that space in them, for example 'F Drive' -> 'F_Drive'.. Previous Comments: ------------------------------------------------------------------------ [2003-10-10 09:17:42] mattj at exitcare dot com It is not security. I went to the Sharing tab and clicked the Perissions button for the F Drive Share. I gave Everyone full control. I also went to the Security tab and set Everyone to full control. Applied the changes, reran the script. Exact same result. ------------------------------------------------------------------------ [2003-10-10 07:03:46] [EMAIL PROTECTED] "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." from bug #22153 ------------------------------------------------------------------------ [2003-10-09 13:04:54] mattj at exitcare dot com Looks like it yields the same results. <?php $dir1 = "\\\\matt\\F Drive\\"; $dir2 = "\\\\192.168.0.6\\F Drive\\"; $dir3 = "//matt/F Drive/"; $dir4 = "//192.168.0.6/F Drive/"; opendir($dir1); opendir($dir2); opendir($dir3); opendir($dir4); ?> Warning: opendir(\\matt\F Drive\): failed to open dir: Invalid argument in C:\Inetpub\wwwroot\ExitCareWeb\test.php on line 6 Warning: opendir(\\192.168.0.6\F Drive\): failed to open dir: Invalid argument in C:\Inetpub\wwwroot\ExitCareWeb\test.php on line 7 Warning: opendir(//matt/F Drive/): failed to open dir: Invalid argument in C:\Inetpub\wwwroot\ExitCareWeb\test.php on line 8 Warning: opendir(//192.168.0.6/F Drive/): failed to open dir: Invalid argument in C:\Inetpub\wwwroot\ExitCareWeb\test.php on line 9 ------------------------------------------------------------------------ [2003-10-09 12:32:58] [EMAIL PROTECTED] MSDN docs on FindFirstFile (the win32 API that underlies opendir) state: ----- ... Similarly, on network shares, you can use an lpFileName of the form "\\server\service\*" but you cannot use an lpFileName that points to the share itself, such as "\\server\service". To examine any directory other than a root directory, use an appropriate path to that directory, with no trailing backslash. For example, an argument of "C:\windows" will return information about the directory "C:\windows", not about any directory or file in "C:\windows". An attempt to open a search with a trailing backslash will always fail. ----- So, try it with a trailing backslash. ------------------------------------------------------------------------ [2003-10-09 12:16:40] mattj at exitcare dot com Description: ------------ I've looked at the documentation for opendir() and it says: opendir -- open directory handle resource opendir ( string path) It doesn't specifiy exactly what a valid path is, so maybe this isn't a bug and is working as intended, but I don't know. I used the following code to just test opendir() accross a network to a windows share. The computer's name I am trying to access is 'matt', the IP is '192.168.0.6', and the name of the share is 'F Drive'. I tried it with both the UNC and the IP with the proper escaping and they didn't work. I also tried them with forward slashes, didn't work either. The 'F Drive' share on the XP machine PHP is trying to access has Permissions set up to allow read access to 'Everyone', but with the nature of the error, I don't think permissions is even relevant, but I figured I should just mention that in case. Are windows network shares / UNC's not supported by PHP? I couldn't find any documentation on PHP's manual about network shares. They all returned Invalid Argument. Reproduce code: --------------- <?php $dir1 = "\\\\matt\\F Drive"; $dir2 = "\\\\192.168.0.6\\F Drive"; $dir3 = "//matt/F Drive"; $dir4 = "//192.168.0.6/F Drive"; opendir($dir1); opendir($dir2); opendir($dir3); opendir($dir4); ?> Expected result: ---------------- Shouldn't error. No output. Actual result: -------------- Warning: opendir(\\matt\F Drive): failed to open dir: Invalid argument in C:\Inetpub\wwwroot\ExitCareWeb\test.php on line 6 Warning: opendir(\\192.168.0.6\F Drive): failed to open dir: Invalid argument in C:\Inetpub\wwwroot\ExitCareWeb\test.php on line 7 Warning: opendir(//matt/F Drive): failed to open dir: Invalid argument in C:\Inetpub\wwwroot\ExitCareWeb\test.php on line 8 Warning: opendir(//192.168.0.6/F Drive): failed to open dir: Invalid argument in C:\Inetpub\wwwroot\ExitCareWeb\test.php on line 9 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=25805&edit=1