note 79685 added to function.opendir
| From: | mana at averna dot com | Date: | Fri, 07 Dec 2007 23:02:14 +0000 |
| Subject: | note 79685 added to function.opendir | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-132945@lists.php.net to get a copy of this message | ||
I was trying to access network drives using this opendir function. I read so many posts saying that
it was almost impossible to access a network drive and finally, I found the answer; there are 2
steps to be followed to access a network drive with PHP either on the same machine or another
machine.
But first of all, here's the error I was getting:
Warning: opendir(\\server\folder1\sub_folder) [function.opendir]: failed to open dir: No error in
C:\wamp\www\PMOT\v0.1\REPORT_MENU\index.php on line 17
Firstly, one must make sure that the folder \\server\folder1\sub_folder can be accessed by a user,
let's say USER_TEST with a password PASS_TEST. By setting properties to this folder, one can
add this given user with the correct password (USER_TEST with PASS_TEST).
Secondly, the APACHE service must be set-up to take this user into account. If no user is specified,
APACHE uses an anonymous user and this is where the problem/error message is coming from. One must
go in control panel->administrative tools->services. One will see the list of services and
must look for APACHE with Apache/2.X.X in the description. (For Wampserver, it will be called
wampapache, and so on!) Right click on that and pop up the properties screen. In the tab LOG ON,
there are 2 options: local system account and "this account" which will be a user
specified account. This is where one must specify the USER_TEST and PASS_TEST.
Following these steps worked perfectly for me but if either the folder privileges or apache log on
user is disabled, then I get the initial aforementioned error message.
Anyways, I hope this can help out someone!
Cheers!
Marc
----
Server IP: 216.235.15.211
Probable Submitter: 209.104.75.198
----
Manual Page -- http://www.php.net/manual/en/function.opendir.php
Edit -- https://master.php.net/note/edit/79685
Del: integrated -- https://master.php.net/note/delete/79685/integrated
Del: useless -- https://master.php.net/note/delete/79685/useless
Del: bad code -- https://master.php.net/note/delete/79685/bad+code
Del: spam -- https://master.php.net/note/delete/79685/spam
Del: non-english -- https://master.php.net/note/delete/79685/non-english
Del: in docs -- https://master.php.net/note/delete/79685/in+docs
Del: other reasons-- https://master.php.net/note/delete/79685
Reject -- https://master.php.net/note/reject/79685
Search -- https://master.php.net/manage/user-notes.php