【发布时间】:2014-07-04 04:10:55
【问题描述】:
我正在使用opendir 和readdir 来显示我们文件共享服务器上的可用文件列表:
// defined in config.ini file:
error_reporting(E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR);
ini_set('display_errors', true);
ini_set('display_startup_errors', true);
define('DRAWINGS_PATH', "\\\\Files\\shared\\Engineering\\Drawings\\");
$all_files = array();
if ($handle = opendir(DRAWINGS_PATH)) {
while (($file = readdir($handle)) !== false) {
$lc_file = strtolower($file);
$dwg = strchr($lc_file, '.dwg');
$pdf = strchr($lc_file, '.pdf');
if (($dwg == '.dwg') || ($pdf == '.pdf')) {
//$all_files[] = new HTMLForm_SelectOption('', $file);
// I use the line above, but it's the same as the one below.
$all_files[] = $file;
}
}
closedir($handle);
}
当我在本地 PC 上进行测试时,我会看到该文件夹中的所有文件。
当我将它推送到服务器时,它什么也看不到。
这听起来像是名为 Apache 的本地帐户,无法访问我需要读取它的网络文件夹。
当我被远程访问服务器时,运行我们的网络服务器的本地帐户似乎可以访问。
我看到的唯一内容是一台 PC 上的用户帐户显示 Apache,而授予文件夹权限的用户名是 FILES\Apache 并显示 Apache Web Server -但我们的网络人员说这些是同一个帐户。
我还能检查什么?
[更新]来自 php_info():PHP Version 5.3.10
[UPDATE 2]显示来自config.ini 文件的信息
[更新 3]
设置HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters\RestrictNullSessAccess = 0 没有解决这个问题。
我可以使用 Apache 帐户远程登录服务器,并查看我需要访问的文件:
但是,当我尝试让 Apache 帐户读取这些文件以便它们可以显示在网页上时,我收到以下错误:
警告:opendir(\Files\shared\Engineering\Drawings,\Files\shared\Engineering\Drawings):访问被拒绝。 (代码:5)在 C:...\FormView.php 中的第 183 行警告:opendir(\Files\shared\Engineering\Drawings): failed to open dir: No such file or directory
【问题讨论】: