How to enable ‘display_errors’ for debugging PHP


I get a lot of questions about how do we turn on ‘display_errors’ in PHP for debugging purposes. Although there are unlimited resources on the Internet which describes the process but I always see that there is some incomplete information regarding this. The clients get confused about this particular parameter because apparently there are two instances/locations of ‘display_errors’ in the configuration file of PHP.

In this small tutorial, I will show you how you make changes at the correct place so that you can turn ‘display_errors‘ on without any confusion. As mentioned, there are two locations of this parameter:


First instance is at line number 96 (might be different for you depending upon the PHP version and OS used).


Second instance is at line number 469, which again might be different for your installation.

In order to enable ‘display_errors’, you need to edit ‘Off’ to ‘On’ at line number 479, that is second instance and not the first one.

Once you make this change, you will need to reload/restart the web service in order to make the changes effective. If you are using FPM process to manage PHP, then reload/restart ‘php-fpm‘ process to make this change effective. You can confirm if the value has been changed from ‘Off’ to ‘On’ by accessing the phpinfo() page and searching for ‘display_errors‘ which should show that it is set to ‘On.

Feel free to write a comment if you have any doubt or suggestions.

Leave a Reply

Your email address will not be published. Required fields are marked *