Issue getting subdirectories to display on screen
| From: | Aleman, Steve P. | Date: | Thu, 21 Jun 2012 13:58:39 +0000 |
| Subject: | Issue getting subdirectories to display on screen | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-13754@lists.php.net to get a copy of this message | ||
Need assistance for the following issue:
After installing server updates to our web server a few months ago, suddenly, several PHP web pages
stopped functioning properly and displaying the following errors:
(fyi...using PHP 5.1, IIS 6.0 on the web server; Windows 7 and IE 8.0 on my PC)
Warning: opendir(\\fileserver\Group\Safety\) [function.opendir<http://bihome.srv.gapac.com/old_site/intranet/safety_search/function.opendir>]:
failed to open dir: Invalid argument in
E:\Inetpub\wwwroot\Intranet\intranet\includes\classes\FoldersFiles.php on line 20
Warning: readdir(): supplied argument is not a valid Directory resource in
E:\Inetpub\wwwroot\intranet\includes\classes\FoldersFiles.php on line 21
Warning: closedir(): supplied argument is not a valid Directory resource in
E:\Inetpub\wwwroot\intranet\includes\classes\FoldersFiles.php on line 36
Here's the PHP code referenced in the errors above:
class FoldersFiles {
var $files;
var $folders;
function read_dir($current_dir)
{
$folder_count = 0;
$file_count = 0;
$dh = opendir($current_dir);
while ($file = readdir($dh)) {
if ($file != '..') {
if ($file != '.') {
$current_element = $current_dir."\\".$file;
if(is_dir($current_element)) {
$this->folders[$folder_count] = $file;
$folder_count++;
}
else {
$this->files[$file_count] = $file;
$file_count++;
}
}
}
}
closedir($dh);
}
}
?>
The web page is supposed to display a series of folders that exist on the fileserver and allow a
user to click on any of them to view their respective sub-directories, so that they can do a
keyword(s) search.
When I comment out the PHP code that displays the 3 folders on the web page, the keyword search
feature works fine, which is why I'm puzzled as to why the sub-directories won't display
on screen like they used to. I've checked the PHP.ini file for any discrepancies and
permissions on the web and file servers to see if it might help, but nothing helped.
I'm not sure what caused this to happen and what to do to resolve it as I've spent a lot
of time researching online and have not yet found a permanent solution.
So, when I found your email address on the PHP.net website, I was wondering there was someone
available who can provide some instruction/direction on how to resolve these errors?
Thanks!
Steve Aleman
Technical Support Specialist
Georgia-Pacific, LLC
434-299-7344 (office)
434-609-7344 (mobile)
spaleman@gapac.com<mailto:spaleman@gapac.com>