I've recently switched from WAMP/XAMPP to LAMP and one thing I found useful was the clean, formatted error reporting. On my current server it just displays errors as plain text, and it can be hard to read through using a web browser (and not viewing source). So is there any way to display errors similarly to WAMP, like in an HTML table with styling?
2 Answers
It's a PHP setting, not specific to any *AMP platform, set in php.ini:
html_errors = 1
relevant docs: http://www.php.net/manual/en/errorfunc.configuration.php#ini.html-errors
2 Comments
In php.ini there are several settings that can be adjusted to create a readable result.
display_errors = On- this one is not directly related to the question, but for obvious reasons I thought it should be included;html_errors = On- php engine will render the errors as a HTML page, not just plain text;error_prepend_string = "<pre>"(really important in some cases);error_append_string = "</pre>"(really important in some cases).
3 and 4 are needed for when PHP inserts the error in a HTML page with just new line characters and no <br> tags. Those settings will encapsulate the error inside a <pre> tag, so new line characters will be preserved.
Of course, you can add styles inside the <pre> tag. For example, I use
"<pre style='white-space: pre-line'>"
to allow line breaks on really long lines.