我正在尝试定制错误页面 - 我做错了什么?

I am using xampp which has Apache 2.4.3. In the file xampp/apache/conf/httpd.conf I have set "AllowOverride All". In xampp/htdocs/.htaccess I have set "ErrorDocument 500 /InitialError.php". InitialError.php is a file that for now is just echoing out some simple html. In my file xampp/htdocs/index.php I have the line "$new = new unknownclass();" where the class unknownclass is undefined.

When I run the index.php file all I am seeing is the error message "Fatal error: Class 'unknownclass' not found in C:\xampp\htdocs\index.php on line 3" and if display_errors is false I do not see anything.

Is there something else I need to be setting?

You can't do that with htaccess.

Something along the lines of:

Apache: ah a php request, thats php's job

PHP: I got this.

Apache: Ok I am going home.

PHP: shit I dont got this.

Its PHP's problem to return a error page.

if something goes bad within apache the page should work!

PS check

http://php.net/manual/en/function.register-shutdown-function.php

http://php.net/manual/en/function.set-error-handler.php