Apache ErrorDocument not working for PHP 500 error

I have a set of settings ErrorDocumentsin my .htaccess file for errors like 404, 401, 403, etc. that all redirect to my error page, but ErrorDocumentset to error 500, it never shows up when PHP reports 500. Code 500 is sent to the browser, and the output is empty. Is there anything special I need to do to include 500 error documents for use with PHP?

My directives are as follows:

ErrorDocument 401 /errorpage.php?error=401
ErrorDocument 403 /errorpage.php?error=403
ErrorDocument 404 /errorpage.php?error=404
ErrorDocument 500 /errorpage.php?error=500

I looked through php.ini and see nothing that will explicitly override Apache settings, and there are no directives in my httpd.conf ErrorDocument. Wherever I look?

Thanks in advance.

+5
source share
4

. . , PHP - 500.

+2

, ErrorDocument conf Apache. vhost conf, .

0

codeigniter Imagick. imagick 500 HTTP-, - , Commigniter custom 500 .

, try-catch Imagick. , 500, try-catch.

 ErrorDocument 500 /errorpage.php?error=500

, , , , , Apache PHP. , - PHP- 500, , , 500.

0
source

I do not believe that Apache will allow you to run PHP files with 500 errors, since the error page may cause an error. Try to output your 500 error to an HTML file and point your directives to it.

-1
source

All Articles