Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I have a flash drive(or hdd) connected to Linksys Router and set it up for access without login. Then I setup netword drive at Computer(Windows 7 Proffesional x64). I tried opendir(\192.168.1.1); but i'm getting this error

 Warning: opendir(\\192.168.1.1\s2,\\192.168.1.1\s2): The network name cannot be found.       (code: 67) in C:\xampp\htdocs\movies.php on line 4
 Warning: opendir(\\192.168.1.1\s2): failed to open dir: No such file or directory in C:\xampp\htdocs\movies.php on line 4
 Warning: readdir() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\movies.php on line 5

Then I tried couple of tips at php.net opendir comments, but when i tried to log on apache as my account I'm geeting error :

Windows could not start the apache2.4 service on Local Computer Error 1069: The service did not start due to a logon failure.

The PHP Code:

$path = '\\192.168.1.1\\s2';
$dir = opendir($path);
while($temp = readdir($dir))echo $temp;

EDIT : well i made apache to log on an admistrator account that i created specialy for this purpose, but still i'm getting this error:

Warning: opendir(\\192.168.1.1\s2\,\\192.168.1.1\s2\): The network name cannot be found. (code: 67) in C:\xampp\htdocs\movies.php on line 4
share|improve this question

1 Answer

up vote 0 down vote accepted

\192.168.1.1 is invalid address for network share. Have you tried \\192.168.1.1?

And in both cases you should escape that \ and write the address as a proper string with quotation marks.

Also, \\192.168.1.1 alone is not "a valid folder", you have to specify one of the network shares under this IP address.

That being said, you should use opendir("\\\\192.168.1.1\\share").

share|improve this answer
well that is my fault i didn't write it correctly in my question the code is :$path = '\\192.168.1.1\\s2'; $dir = opendir($path); while($temp = readdir($dir)){ echo $temp; } – Sysel 20 hours ago
You only forgot to escape then. $path = '\\\\192.168.1.1\\s2'; – Havenard 19 hours ago
i tried even with the escaped path it doesn't work, i think my problem is that apache can't acces network drives and i can't make apacha service log on with any other user account – Sysel 16 hours ago
Make a mapped network drive then and access the drive letter, it should work. But I have Apache on Windows here and it worked fine with tests. – Havenard 13 hours ago
thank you :) adding the drive letter worked – Sysel 7 hours ago

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.