• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Server problem with PHP readdir

Dakis

Well-known member
#1
I converted my old Photopost Pro gallery to XFMG yesterday and I had to move the old photopost folderto another folder on the same server, and I also changed its configuration to reflect the new location.

However I am now getting millions of these error messages:

PHP Warning: readdir() expects parameter 1 to be resource, boolean given in /***/adm-inc.php on line 690
This error log keeps building in gigabytes and choking my server disk space. I am deleting it every few minutes and it keeps coming back.

This is the function at line 690 on that file:

while (($file = readdir($dh)) !== false)
And these are lines 684-710:

PHP:
function dirsize($dir)

{

$dh = opendir($dir);
$size = 0;

while (($file = readdir($dh)) !== false)
{
   if ($file != "." and $file != "..")
   {
       $path = $dir."/".$file;

       if (is_dir($path))
       {
           $size += dirsize($path);
       }
       elseif (is_file($path))
       {
           $size += filesize($path);
       }
   }
}

closedir($dh);

return( $size );

}
It seems to me there must be some funny folder not being accessed or something similar? But why is this creating these millions of errors and how can I at least stop the errors? I don't care about the script actually working at this point. I even DELETED the adm-inc.php file and the error_log file still keeps getting the same error, even though that file is no longer there (!)

Can anyone help with this? I'm forced to spend my Sunday now sitting on my cpanel deleting the error_log file every few minutes as it grows to dozens of gigabytes very fast. :( :( :(