Relative:
Service not able to access a mapped drive
PHP is_dir and mkdir not working on mapped network drive
I know this is very old-school, but I just can’t figure it out…
On a Windows 2003 with wamp (apache 2.2, PHP 5.3.10) run as a service. Following the above link, I’ve already made it run as Administrator instead of SYSTEM. But still no luck.
I made a .bat file to make it clear:
@echo off
whoami
net use
php -r "var_dump(scandir('Z:\\'));"
php -r "var_dump(scandir('\\\\192.168.211.86\\voice'));"
php -r "var_dump(scandir('//192.168.211.86/voice'));"
And if I run it in cmd, the result is:
serv2003\administrator
New connections will be remembered.
Status Local Remote Network
-------------------------------------------------------------------------------
OK R: \\192.168.211.86\voice Microsoft Windows Network
OK Z: \\192.168.211.86\voice Microsoft Windows Network
The command completed successfully.
array(5) {
[0]=>
string(1) "."
[1]=>
string(2) ".."
[2]=>
string(6) "Folder"
}
array(5) {
[0]=>
string(1) "."
[1]=>
string(2) ".."
[2]=>
string(6) "Folder"
}
array(5) {
[0]=>
string(1) "."
[1]=>
string(2) ".."
[2]=>
string(6) "Folder"
}
But if I run it in Apache:
<body><pre>
<?php
echo `C:\path\to\test.bat`;
?>
</pre></body>
it outputs:
serv2003\administrator
New connections will be remembered.
Status Local Remote Network
-------------------------------------------------------------------------------
Unavailable Z: \\192.168.211.86\voice Microsoft Windows Network
The command completed successfully.
Warning: scandir(Z:\): failed to open dir: No such file or directory in Command line code on line 1
Warning: scandir(): (errno 2): No such file or directory in Command line code on line 1
bool(false)
Warning: scandir(\\192.168.211.86\voice): failed to open dir: No such file or directory in Command line code on line 1
Warning: scandir(): (errno 2): No such file or directory in Command line code on line 1
bool(false)
Warning: scandir(//192.168.211.86/voice): failed to open dir: No such file or directory in Command line code on line 1
Warning: scandir(): (errno 2): No such file or directory in Command line code on line 1
bool(false)
Notice that yes there’s a R: driving missing in Apache module, but since I’m accessing Z:, I assume that’s not the problem.
I don’t have access to the remote folder, and I can’t copy all files to local system. All I need is the ability to read them in PHP. What can I do?
Thanks in advance!
Edit 1:
Not sure if this matters, but I’m accessing this server via Remote Desktop (it’s geographically far from me).
And the \\192.168.211.86\voice uses username/password to map.
All the above practice is run in the same login session.
Try to install Apache, PHP and MySQL manually. Once I had really headache with WAMP when I try to run a code using Curl (in PHP CLI mode) and it took days to investigate what was the problem, since that day I never install pre-bundle packages even to any testing environment.
This link will guide you: http://docs.joomla.org/Setting_up_Apache,_PHP_and_MySQL_manually
Check the server firewall also.