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.
Could anyone help?
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.
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
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
echo "No target file";
header ("http/1.0 404 Not Found");
save this as index.php or any other name, and call your document via filename.php?q=path/to/yourdocument
Thank you all for your reply. I will test this out and let you know what happens.