[PHP] apache not handling 404 errors for .php pages

2001-07-12 Thread scott [gts]

I have custom 404 error handling setup on my linux apache
box, however, there's a problem with files that have a PHP
extension.  it seems that apache itself does not check for the
existence of the requested .php file and fires up PHP no matter
what.  if PHP does not find the requested file, it'll bail out
with that dorky looking Internal Server Error *NOT* the
custom error handler that apache uses for non-php files

example: notexists.html and notexists.php both do not exist

http://server.com/notexists.html
will show me the custom 404 page

http://server.com/notexists.php
will show me the Internal Server Error, becuase apache fired
up PHP and passed in notexists.php without checking for the
existence of notexists.php first.

A possible solution that comes to mind is to auto_prepend
a script that will check for the existance of the file
that PHP is attempting to execute, and die gracefully if
it does not exist on the server but that would be a bad
kludge hack (if it even works at all)

anyone have a more elegant solution?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] apache not handling 404 errors for .php pages

2001-07-12 Thread DAve Goodrich

on 7/12/01 12:38 PM, scott [gts] at [EMAIL PROTECTED] wrote:

 I have custom 404 error handling setup on my linux apache
 box, however, there's a problem with files that have a PHP
 extension.  it seems that apache itself does not check for the
 existence of the requested .php file and fires up PHP no matter
 what.  if PHP does not find the requested file, it'll bail out
 with that dorky looking Internal Server Error *NOT* the
 custom error handler that apache uses for non-php files
 
 example: notexists.html and notexists.php both do not exist
 
 http://server.com/notexists.html
 will show me the custom 404 page
 
 http://server.com/notexists.php
 will show me the Internal Server Error, becuase apache fired
 up PHP and passed in notexists.php without checking for the
 existence of notexists.php first.
 
That would be the correct response from apache.
Add this to your httpd.conf

ErrorDocument 500 /path/to/my_error_page.html

That should get you the result you want.

DAve

P.S. http://httpd.apache.org/docs/custom-error.html.html

 A possible solution that comes to mind is to auto_prepend
 a script that will check for the existance of the file
 that PHP is attempting to execute, and die gracefully if
 it does not exist on the server but that would be a bad
 kludge hack (if it even works at all)
 
 anyone have a more elegant solution?

--
Dave Goodrich
Director of Interface Development
Reality Based Learning Company
9521 NE Willows Road, Suite 100
Redmond, WA 98052 
Toll Free 1-877-869-6603 ext. 237
Fax (425) 558-5655 
[EMAIL PROTECTED] 
http://www.rblc.com



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]