PHP Errors Display ON and OFF for Windows and Linux (Ubuntu)

Displaying Errors ON is a good way of dealing with the errors, warning etc., but only when you are running your code on Testing Environment aka Development Environment. But when you are running your code on Live Environment, then it is not suitable to make your errors, warnings, notices etc. ON. As it would make bad impact on the visitors of your website.

How to Display Errors ON for Windows

If you are a Windows user, then you have to modify the php.ini file.

Goto your wamp folder, which would be like:

D:\wamp\bin\apache\apache2.2.6\bin\

And open the file

php.ini

If you are unbable to find the folder or file as mentioned above, or if you are using some other server in Windows, then simply find the php.ini file located under apache folder (and not php folder), and open it in a text editor.

Find the text

display_errors = Off

and replace the text with:

display_errors = On

Save the file, and restart your Apache Server. And the problem is solved.

How to Display Errors ON for Linux (Ubuntu)

If you are a Ubuntu or Linux user, then you have to modify the php.ini file.

Goto your apache folder, which would be like:

/etc/php5/apache2/

And open the file

php.ini

If you are unbable to find the folder or file as mentioned above, then simply find the php.ini file located under apache folder, and open it in a text editor.

Find the text

display_errors = Off

and replace the text with:

display_errors = On

After saving the file, restart your Apache Server with the following command:

sudo /etc/init.d/apache2 restart

And the problem is solved.

If you are still unable to see the PHP errors, following post may be helpful:

PHP Error Reporting Code

Uncategorised

Leave a Reply

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