0

I'm attempting to build an error handling service for my CodeIgniter apps, and everything is logged as expected except parse errors. For example,

Parse error: syntax error, unexpected T_VARIABLE in /var/www/foo/web/app/controllers/foo.php

... will output and get logged by Apache under E_ALL. All other (non-parse) errors get passed to the log_exception extension I've written in /core/MY_Exceptions.php, and show up in CI's logs with PHP 5.2.17 and 5.3.6 (MAMP). Parse errors will display in Apache's native error log, but NOT in CodeIgniter's logs – they seem to miss CodeIgniter altogether.

How can I ensure that parse errors get picked up by CI? Am I missing something obvious?

1 Answer 1

1

This may help you: Why is codeigniter not logging error!

If the page is failing to load because of a parse error, then it'll never execute

error_reporting(E_ALL);

so you script will never know to output the error. Edit your php.ini file to make sure you have:

error_reporting = E_ALL
error_log = "/path/to/some/apache/writable/file"

Hope this helps.

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

2 Comments

Thanks! That makes sense, and it also seems like there's no way to catch the error at the application level if it never runs in the first place. Which is a bummer.
yeah it breaks the flow and makes it difficult to log.

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.