How To Display PHP Errors – Windows, Linux

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

Share with:


3 comments
  1. I did that, but php don’t show the error line like Windows, when I have an error on Linux in PHP the browser screen come white and I want that PHP show me where is the error line to fix it.

    help me

Leave a Reply

Login with:



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