SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Member
    Join Date
    Dec 1999
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello. I am using PHP and Apache on Win98 and I am having
    trouble setting up the ErrorDocument directives.

    I edited the httpd.conf file with:

    ErrorDocument 404 /somefile.php

    where somefile.php contains code to output a specific message based on the code.

    This directive works for .html, .txt, and other extensions, EXCEPT for .php extensions.

    Can someone tell me what I might be doing wrong.

    Thanks!
    sTephen
    visit MadCityStyle.com

  2. #2
    SitePoint Member
    Join Date
    Dec 1999
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Could anyone help?
    Please?
    visit MadCityStyle.com

  3. #3
    SitePoint Zealot Website Rob's Avatar
    Join Date
    Aug 2000
    Location
    Alberta, Canada
    Posts
    113
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I take it you are using PHP3 and not PHP4? The latter should allow you to use the php extension with no problem. For the former, try using the following in your httpd.conf file:

    Mime Type:"text/php" (type/subtype) Extension: phtml
    Mime Type:"text/php3" (type/subtype) Extension: phtml

    The "(type/subtype)" part you can leave out. I only included that for your clarification.

    If after doing the above and it still doesn't work, put your ErrorDocument statement into an .htaccess file and try that.

  4. #4
    The Hiding One lynlimz's Avatar
    Join Date
    Jul 2000
    Location
    Singapore
    Posts
    2,103
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hmm..there shouldn't be a problem..
    afterall a missing .php file is still an error 404?

    did i get you right? dun really understand your question
    "Imagination is more important than knowledge. Knowledge is limited. Imagination encircles the world."
    -- Albert Einstein

  5. #5
    SitePoint Member
    Join Date
    Jul 2000
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Dear sTephen...

    It displays a parse error stating that it cannot find xxx.php instead of the default errordocument, right?

    This is because the php.exe in Win32 environment is not built into the webserver exe file, and does not send a 404 header when it encounters a file-not-found error. I use a simple error tracking PHP code

    if (!isset($q)){
    echo "No target file";
    }
    elseif (!file_exists($q)){
    header ("http/1.0 404 Not Found");
    }
    else{
    require ($q);
    }

    save this as index.php or any other name, and call your document via filename.php?q=path/to/yourdocument



    Hope that helps
    - Jeramii-chan (Jeremy)
    _____________________________
    a@hk : http://www.animehk.com/

  6. #6
    SitePoint Member
    Join Date
    Dec 1999
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you all for your reply. I will test this out and let you know what happens.
    visit MadCityStyle.com


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
  •