PHP 5 solaris opendir failure

Hello!

I've moved a web from my RHEL5 Apache/2.2.3 machine to a Sun Solaris 5.9 Apache/2.2.6 (Unix) PHP/5.2.5 mod_ssl/2.2.6 machine.

The web worked just fine on the rhel5 machine and most of the php pages works fine on the solaris machine to but not the one where I read a directory and prints out the files.

This is the code that does not work:

<?php
if ($handle = opendir('/the/directory')) {
    while (false !== ($file = readdir($handle))) {
       if(stripos($file, ".html")) {
          echo "<a href=waittimeofjobs/".$file.">".$file."</a><br/>";
       }
    }
    closedir($handle);
}
?>

It seems like that php just stops generating code when reaching this code because the source file gets empty, not even the static html tags gets written.

Is there some way to debug this?
Even if I remove the code and just puts a simple:
error_reporting(E_ALL);
the same thing happends, no code gets generated.

maybe PHP is not configured properly/too strict
safe mode ON, open_basedir restriction, something like that
i had strange blank screens from these causes earlier