Make PHP errors easier to read

By Eoin on 19 February 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 and Contact · All posts