php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40117 Unable to access mapped network drive
Submitted: 2007-01-13 04:57 UTC Modified: 2007-01-15 09:37 UTC
From: jsbruns at selectionsheet dot com Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: 5.2.0 OS: Windows 2003 Server
Private report: No CVE-ID:
 [2007-01-13 04:57 UTC] jsbruns at selectionsheet dot com
Description:
------------
I'm running windows 2003 server and have several mapped drives within my network. I'm trying to access a file on a drive mapped as F:\ 

I can access the drive from windows explorer and am running apache as a service under an administrative user that has proper permissions. 

I've tried a variety of connection methods including specifying the drive letter, the server name and the IP address. All with no success. Any help would be appreciated.



Reproduce code:
---------------
$dbh = opendir("F:\W_54620.DBF","r");
$dbh = opendir("\\server02\W_54620.DBF","r");

failed to open dir: Invalid argument in C:\httpd\dbf_class.php on line 2


Expected result:
----------------
Provide a valid object after successful file open.

Actual result:
--------------
Unable to open stream to file on network drive.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-01-13 12:56 UTC] johannes@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

You need to use \\ instead of a single \ in double quotes.

$dbh = opendir("F:\\W_54620.DBF","r");

or use single quotes

$dbh = opendir('F:\W_54620.DBF',"r");
 [2007-01-13 14:51 UTC] jsbruns at selectionsheet dot com
Thanks for your reply, however I have tried using a variety of methods, including escaped backslashes within double quotes and single backslash within single quotes. 

I am still unable to open a file/dir on a mapped network drive.

$dbf = fopen('F:\W_54602.DBF','rb');

Warning: fopen(F:\W_54602.DBF) [function.fopen]: failed to open stream: No such file or directory in C:\httpd\dbf_class.php on line 2
 [2007-01-13 16:43 UTC] iliaa@php.net
Do you have permission to open the file? Both the SMB path 
syntax and the file system access should work assuming the 
file exists and your have access priveleges to open it.
 [2007-01-13 22:51 UTC] jsbruns at selectionsheet dot com
I have apache2.2 running as Administrator on the box and have the user 'Administrator' with 'Log on as a service' priviledges. I have logged on with this same account and browsed to the F drive and opened the file. 

I also tried moving the same file to the C drive and the script worked fine.
 [2007-01-15 09:37 UTC] tony2001@php.net
Still not PHP problem.
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Thu Apr 24 21:01:55 2014 UTC