【发布时间】:2012-09-16 13:52:23
【问题描述】:
亲戚:
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。
-
您是否尝试过通过 Apache 从 PHP 运行
net use? -
@Robbie 你的意思是
net use Z: \\192.168.211.86?我确实尝试过,但似乎Z:不是以这种方式创建的...... -
嗯,
net use Z: \\192.168.211.86\voice,是的。如果您从脚本启动它,它应该适用于 Apache 空间。没试过 - 只是一个建议。
标签: php wamp mapped-drive