Make PHP errors easier to read

February 19, 2012

If you’re not using a framework like Slim for PHP, your errors will be echo’ed out to your browser without formatting.

Easy error formatting

You’ll need to edit out php.ini file for this.

We’ll be following PHP’s Runtime Confirguration instrucitons.

Just set the following variables in php.ini:

error_prepend_string = ''
error_append_string = ''

Simple, now the error will be wrapped in HTML PRE tags to have the error formatted. When you’re debugging code, and there’s an error of multiple lines, at least now the error will be shown by default with line breaks.

About the author

Eoin develops software and runs an Internet-based business (more about me). Follow me on Twitter, and better yet contact me at e@eoinoc.net. © Eoin Ó Conchúir 2009-2014.

comments powered by Disqus