2012-09-25 73 views
3

相对:PHP在WAMP无法访问映射驱动器

Mapped Network Drives

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使用用户名/密码来映射。

上述所有练习都在相同的登录会话中运行。

+0

从相同的登录环境中运行的两个命令?Windows不为不同的用户保留不同的映射... –

+0

@JeremyJStarcher是的,我在同一个登录会话上运行它们,另外,我也尝试过UNC – Passerby

+0

您是否尝试过通过Apache从PHP运行'net use'? – Robbie

回答

0

尝试手动安装Apache,PHP和MySQL。一旦我尝试使用Curl(以PHP CLI模式)运行代码,并且花了几天的时间来调查问题所在,从那一天起,我甚至不会在任何测试环境中安装预捆绑软件包,但一旦我对WAMP感到头疼。

此链接会引导你:http://docs.joomla.org/Setting_up_Apache,_PHP_and_MySQL_manually

检查服务器的防火墙也。

+0

我没有完全控制服务器,所以这不是一个选择。无论如何,我(不知何故)通过说服远程机器的所有者来安装Apache来解决这个问题。 – Passerby

+0

虽然对我来说不是一种选择,但我个人认为这可以解决它,所以我会将此标记为答案,并希望其他人可能会发现这有帮助。这是我第一次使用WAMP,并且发现它有点令人沮丧,与单独安装的PHP相比。 – Passerby

0

设置所有的服务是不必要的。问题是当你使用网络驱动器时,wamp和apache是​​ ,apache无法启动,在这种情况下wamp的颜色一般为黄色,或者apache发出错误。确保使用cmd行打开httpd.exe。 你会看到一个错误“驱动器找不到,Apache无法启动等。“ 毕竟它可能是你意识到的问题是WAMP的阿帕奇不能作为服务启动。本文将帮助你。

Apache Network Drive Alias