1

I accidentally pushed a bad piece of code yesterday. My site was down for the entire day. Embarrassing, yes. The worst part was that my customers had no way of contacting me to tell me it was down.

I can't see to get the custom error page of codeigniter working for php errors application/errors/error_general.php.

I think this probably needs to be done at the Apache level. I've tried putting ErrorDocument 500 /error.html in the base folders .htacess file. That hasn't worked either.

Basically, I'd like a way to generate a customer error page for php errors in codeigniter. Any suggestions?

2
  • 500 errors -> something went terribly wrong, no further processing (parse errors and the like), not even an error page can be created (on 'less severe' errors it can be used). And as Apache has handed of to PHP, the ErrorDocument also won't be used. I'd suggest monitoring error logs by cron-job. Commented Jan 13, 2012 at 18:49
  • That's what I feared. Thanks Commented Jan 13, 2012 at 19:33

2 Answers 2

2

If you look at system/core/CodeIgniter.php#63, then system/core/Common.php#450, then system/core/Exceptions.php#149, you will note that error handler page is application/errors/error_php.php. Note that some fatal errors definietely cannot be handled by that template (link).

The following error types cannot be handled with a user defined function: E_ERROR, E_PARSE, E_CORE_ERROR, E_CORE_WARNING, E_COMPILE_ERROR, E_COMPILE_WARNING, and most of E_STRICT raised in the file where set_error_handler() is called

Sign up to request clarification or add additional context in comments.

Comments

0

Actually, I figured it out. It needed to be done in the .htaccess file at the root of Codeigniter

Example from an .htaccess file

ErrorDocument 500 /errors/500.htm

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.