Service not able to access a mapped drive
PHP is_dir and mkdir not working on mapped network drive
我知道这是很老派,但我无法弄清楚...
在带有wamp(apache 2.2,PHP 5.3.10)的Windows 2003上作为服务运行。在上面的链接之后,我已经使其运行为Administrator
而不是SYSTEM
。但仍然没有运气。
我做了一个.bat
文件,以明确:
@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'));"
如果我在cmd
运行它,结果是:
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"
}
但是,如果我在Apache中运行它:
<body><pre>
<?php
echo `C:\path\to\test.bat`;
?>
</pre></body>
它输出:
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)
请注意,在Apache模块中缺少驱动R:
,但由于我正在访问Z:
,我认为这不是问题。
我无权访问远程文件夹,也无法将所有文件复制到本地系统。我需要的是能够在PHP中阅读它们。我能做什么?
在此先感谢!
编辑1:
不知道这事,但我通过远程桌面访问这台服务器(这是地理上离我好远)。
而\\192.168.211.86\voice
使用用户名/密码来映射。
上述所有练习都在相同的登录会话中运行。
从相同的登录环境中运行的两个命令?Windows不为不同的用户保留不同的映射... –
@JeremyJStarcher是的,我在同一个登录会话上运行它们,另外,我也尝试过UNC – Passerby
您是否尝试过通过Apache从PHP运行'net use'? – Robbie