Problems following server upgrade to 5.4

My host is running PHP 5.2 and I thought everything would be just great. First error was in the code I use to make sure everything is initialized to include the few functions I have, login to the database, and set the time. I have the following error settings:


It gave me a fatal error on this line of code:


I currently commented this line out and have searched for the correct code. This leaves me wondering what my code should read?

My second error comes from the second line of code in this:

foreach (new DirectoryIterator('../documents') as $fileInfo) {
    if($fileInfo->isDot()) continue;
    echo '<p class="adobe"><img src="/images/pdficon_small.gif" width="17" height="17" title="PDF icon" alt="PDF icon" /><a href="../documents/' . $fileInfo->getFilename() .  ' ">' . $fileInfo->getFilename() .  '</a></p> ';

I am trying to get a list of every file and create a link to allow that PDF to be opened.

As it stands, I have the website running, but the documents that should show are not.

Personally I find it weird that a host actually ‘upgrade’ to an old dinosaur like PHP 5.2, what was it originally on? PHP 4?

Post the exact error messages you are receiving.

Fatal error: Cannot instantiate non-existent class: directoryiterator in cont_documents.php on line 9

The first 7 lines are HTML code and the code in my message above starts with the 8th line.

I would guess the PHP install got messed up somehow. It’s saying it can’t instantiate DirectoryIterator? That’s part of the SPL which is included with PHP 5 and since 5.3 can not be disabled.

Guess I need to open a ticket with my host.

My host checked and sent me the following:

“DirectoryIterator() does work in our Linux Shared hosting packages. It might be just a misconfiguration from your end.”

Is there something in htaccess I should change?