开发者

How do i have Apache to do further handling of the error status set within the PHP script?

开发者 https://www.devze.com 2023-01-05 20:54 出处:网络
My environment is: shared hosting with PHP 5.2 installed as apache2handler I have ErrorDocuments configured:

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 Apa开发者_StackOverflow社区che sort it out?


PHP is broken and this question proven to be unanswerable


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.
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号