How to: Find your php.ini file and enable PHP error reporting

On some distributions PHP error reporting or display of errors is disabled by default as a security precaution. This is a good idea for production systems because errors may reveal useful information to undesirables. In a development environment on the other hand, it is generally useful to see your errors. 😉 If error display is disabled you may just see a blank browser window/empty page when you expect an error. To enable errors and error display, find the your php.ini file and make sure the following lines are set:

;Show all errors, except for notices and coding standards warnings
error_reporting = E_ALL & ~E_NOTICE

display_errors = On

On Ubuntu you can find the php.ini file here:
/etc/php5/apache2/php.ini

On other distributions try:
/etc/php.ini

On Windows you might find it here:
c:\windows\php.ini

If you are running XAMPP it will be in the php folder off the XAMPP root.

You will need to restart Apache (or IIS as the case may be) so your changes will take effect:

On Ubuntu:

sudo /etc/init.d/apache2 restart

On other distributions you might try:

sudo /etc/init.d/httpd restart

Leave a Reply