SitePoint Sponsor

User Tag List

Results 1 to 10 of 10
  1. #1
    SitePoint Evangelist jimday1982's Avatar
    Join Date
    Sep 2002
    Location
    Atlanta, GA
    Posts
    562
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Server Error Messages

    Just curious if there's a way to display the server generated error message on my error page. For instance, I have my .htaccess file pointing all errors to error.php with a generic message (that I typed on the page). I know I could have multiple error pages, but I want just one that displays the specific error (formatted if possible). Thanks a lot for your help!
    Jimmy Day
    Senior Systems Analyst
    Piedmont Healthcare Corporation

  2. #2
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    All you need to do is set them up like this:

    ErrorDocument 404 /error.php?error=404

    Then you just need to see what $_GET['error'] contains and show the appropriate error

    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature

  3. #3
    SitePoint Evangelist jimday1982's Avatar
    Join Date
    Sep 2002
    Location
    Atlanta, GA
    Posts
    562
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Wow- didn't know it was that simple...I'll give it a shot later tonight. Thanks!
    Jimmy Day
    Senior Systems Analyst
    Piedmont Healthcare Corporation

  4. #4
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Let us know how you get on

    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature

  5. #5
    SitePoint Evangelist jimday1982's Avatar
    Join Date
    Sep 2002
    Location
    Atlanta, GA
    Posts
    562
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm sure this is a dumb question, but does this syntax appear to be correct?

    PHP Code:
    <?php                              echo $_GET['error'];
    ?>
    Jimmy Day
    Senior Systems Analyst
    Piedmont Healthcare Corporation

  6. #6
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There's no such thing as a dumb question

    Yes, that is fine, but if you are using an older version of PHP you may have to use $HTTP_GET_VARS['error']

    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature

  7. #7
    SitePoint Evangelist jimday1982's Avatar
    Join Date
    Sep 2002
    Location
    Atlanta, GA
    Posts
    562
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah - got it, thanks again!
    Jimmy Day
    Senior Systems Analyst
    Piedmont Healthcare Corporation

  8. #8
    SitePoint Zealot
    Join Date
    Oct 2001
    Location
    London, UK.
    Posts
    103
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Alternatively you can use another method.
    I simply pointed all error pages to error.php then used the inbuilt $_SERVER functions such as the ones listed below:

    $_SERVER['REDIRECT_STATUS']
    $_SERVER['REDIRECT_ERROR_NOTES']
    $_SERVER['REDIRECT_REDIRECT_ERROR_NOTES']

    The choice is yours really

    David
    Do you fear the obselescence of the
    metanarrative apparatus of legitimation?

  9. #9
    SitePoint Evangelist jimday1982's Avatar
    Join Date
    Sep 2002
    Location
    Atlanta, GA
    Posts
    562
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Cool-

    I'll mess with that as well. Thanks.
    Jimmy Day
    Senior Systems Analyst
    Piedmont Healthcare Corporation

  10. #10
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You'll need to use $HTTP_SERVER_VARS instead of $_SERVER if you couldn't use $_GET

    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature


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
  •