How to get useful error messages in PHP?

For syntax errors, you need to enable error display in the php.ini.

By default, these are turned off because you don’t want a “customer” seeing the error messages.

In the PHP documentation for information on the 2 directives: error_reporting and display_errors

display_errors is probably the one you want to change. If you can’t modify the php.ini, you can also add the following lines to a .htaccess file:

You may want to consider using the value of E_ALL (as mentioned by Gumbo) for your version of PHP for error_reporting to get all of the errors.

0 Comments

No Comment.