I am using opendir and readdir to display a listing of available files on our fileshare server:
// 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);
}
When I test on my local PC, I see all of the files in that folder.
When I push this up to the server, it does not see anything.
This sounds to me like the local account, named Apache, does not have access to the network folder I need it to read from.
When I am remoted into the server, the local account that runs our web server appears to have access.
The only thing I see is that the user account on one PC says Apache and the username given permission on the folder is FILES\Apache
and says Apache Web Server - but our network guy says these are the same accounts.
What else could I check?
[UPDATE] From php_info(): PHP Version 5.3.10
[UPDATE 2] Displayed info from config.ini
file
[UPDATE 3]
Setting HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters\RestrictNullSessAccess = 0
did not fix this.
I can remote login on the server using the Apache account, and view the files I need to get to:
However, when I attempt to get the Apache account to read these files so they can be displayed on a webpage, I get this error:
Warning: opendir(\Files\shared\Engineering\Drawings,\Files\shared\Engineering\Drawings): Access is denied. (code: 5) in C:...\FormView.php on line 183 Warning: opendir(\Files\shared\Engineering\Drawings): failed to open dir: No such file or directory