I have a network drive mapped to drive letter X:\ going to an external hard drive with the path of "\\X-Drive\Public\Data".
I am using Zend Server with Apache.
My PHP command is simple
$isFolder = is_dir("x:/");
echo($isFolder); //FALSE
Things you should know:
The code:
$isFolder = is_dir("c:/");
echo($isFolder); //TRUE
works as expected.
I am running the Zend Apache service as an administrator user. I know this is working properly because in Task Manager the httpd.exe process shows the correct user.
The drive is indeed mapped. I have tried mapping it with several users, to include the same user that Zend Apache uses to no avail.
I have read every post on this matter that I could find. Every problem I've come across exists either because of user permissions, or a typo. I don't see how my problem fall into either category.
I have also tried:
system('net use X: "\\x-drive\public" password1 /user:username /persistent:no');
$isFolder(is_dir("x:/"));
echo($isFolder); //FALSE
I am running Windows Vista x64, and the production code will run in Windows 7 x64.
What other problems could I be running in to?
For network shares you should use UNC names:
"//server/share/dir/file.ext"
Source
If you use the IP or hostname it should work fine:
$isFolder = is_dir("\\\\NAS\\Main Disk");
var_dump($isFolder); //TRUE
$isFolder = is_dir("//NAS/Main Disk");
var_dump($isFolder); //TRUE
$isFolder = is_dir("N:/Main Disk");
var_dump($isFolder); //FALSE
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With