SitePoint Sponsor

User Tag List

Results 1 to 7 of 7

Hybrid View

  1. #1
    SitePoint Evangelist
    Join Date
    Apr 2009
    Location
    South Carolina
    Posts
    458
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    problems following server upgrade to 5.2

    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:
    PHP Code:
    <?php
     ini_set
    ('display_errors',1);
     
    error_reporting(-1);
     
    ini_set('log_errors',1);
    ?>
    It gave me a fatal error on this line of code:
    PHP Code:
    date_default_timezone_set('America/New_York'); 
    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:
    PHP Code:
    <?php
    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.
    Last edited by CSU-Bill; Aug 29, 2013 at 18:30. Reason: correct php version
    Each day is a learning experience.

  2. #2
    SitePoint Addict bronze trophy Hall of Famer's Avatar
    Join Date
    Apr 2013
    Location
    Ithaca
    Posts
    370
    Mentioned
    6 Post(s)
    Tagged
    2 Thread(s)
    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?

  3. #3
    Barefoot on the Moon! silver trophy Force Flow's Avatar
    Join Date
    Jul 2003
    Location
    Northeastern USA
    Posts
    4,617
    Mentioned
    56 Post(s)
    Tagged
    1 Thread(s)
    Post the exact error messages you are receiving.
    Visit The Blog | Follow On Twitter
    301tool 1.1.5 - URL redirector & shortener (PHP/MySQL)
    Can be hosted on and utilize your own domain

  4. #4
    SitePoint Evangelist
    Join Date
    Apr 2009
    Location
    South Carolina
    Posts
    458
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Force Flow View Post
    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.
    Each day is a learning experience.

  5. #5
    SitePoint Evangelist
    Join Date
    Oct 2005
    Location
    Michigan, USA
    Posts
    434
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    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.
    http://www.php.net/manual/en/spl.installation.php
    - Robert

  6. #6
    SitePoint Evangelist
    Join Date
    Apr 2009
    Location
    South Carolina
    Posts
    458
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Guess I need to open a ticket with my host.
    Each day is a learning experience.

  7. #7
    SitePoint Evangelist
    Join Date
    Apr 2009
    Location
    South Carolina
    Posts
    458
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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?
    Each day is a learning experience.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •