Show all errors while developing

Last updated on
9 January 2024

Drupal 7 will no longer be supported after January 5, 2025. Learn more and find resources for Drupal 7 sites

Set Drupal to show all errors when developing your module.

Some errors are only reported when all PHP error reporting is switched on. Without the error reporting on, you get the dreaded White Screen of Death.

Check for errors behind the scenes

As an alternative between showing no errors and showing all errors, you may wish to monitor the errors being generated by your site by running

tail -f /var/log/apache2/error.log

on your server.

Change settings in your dev site

You can show all errors by adding a few lines to your local testing site's settings.php:

error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);

In addition, navigate to Administration→ Configuration→ Development → logging and errors and select "All messages". (This sets $conf['error_level'] = 2;.)

For Drupal 8+, you may need to add the following to settings.php:

$config['system.logging']['error_level'] = 'verbose';

or you can also set with drush

drush config-set system.logging error_level verbose

Switch on strict PHP error reporting

Or you can go through your development site's php.ini file, in the php folder, and switch all error reporting on. To do this, check through your php.ini file and set error_reporting to E_ALL. The documentation there is very thorough, and you may find a different setting that's better suited to your needs. Warning: as the PHP documentation states, this setting is only for development sites, not for production sites.

Help improve this page

Page status: No known problems

You can: