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