.htaccess & PHP


I’ve properly set-up my .htaccess to accomodate my ErrorDocuments. Testing mydomain.com/missing.html correctly triggers the ErrorDocument 404.

However, I’m seeing something that I’ve never seen with any other server (and I’ve configured quite a few).

The ErrorDocument directive doesn’t work with PHP files. For example, mydomain.com/missing.php should trigger the same ErrorDocument as the .html example above, but instead, I simply get the message, “No input file specified.,” suggesting that PHP is being passed the URL to execute before Apache checks to see that it’s valid.

Proper behavior would be for ErrorDocument to work the same, regardless of the extension of the bad URL.

How do I correct this?


Set PHP to run as an Apache module instead of CGI.

If you want useful replies, ask smart questions.


You were correct. Thanks very much.

The bummer now appears to be that I can’t have both custom ErrorDocument 404 handling, and PHP5?

Looks like it’s a one-or-the-other proposition.


It should be possible to have custom ErrorDocuments and run PHP as CGI.

See What’s the difference between PHP-CGI and PHP as an Apache module? for info (specially the comments).

[color=#000000]DreamHost Promo Code[/color]: [color=#CC0000]Save $50[/color] with the promo code DREAMTEAM