views:

29

answers:

0

Hello!

My environment is: shared hosting with PHP 5.2 installed as apache2handler

I have ErrorDocuments configured:

ErrorDocument 404 "Simply Not Found"
# OR
ErrorDocument 404 /errors/fancy-not-found.php
# both variants works as expected

However, most simple example from PHP manual doesnt want to cooperate with Apache2 and perform compliant error handling:

<?php
header("HTTP/1.0 404 Not Found");
die(); /* results in empty page */
/* OR */
die('Failed');  /* reports failure */
?>

How to amend this code to trigger specified error and make Apache sort it out?


Currently, my findings are:

  • seen desired behavior produced with mod_perl, which have fully featured response API.
  • mod_php is badly designed and is using apache1-style handler instead of apache2 filter(s), effectively disabling ability to pass control back to httpd.
  • most recommended solution is to drop apache features and re-implement all of the handling logic using PHP scripts.