How to enable error reporting in php

How to enable error reporting in php

This article , I copied from

In Shared Web hosting, normally we won’t be having access to the root folder php.ini file for changing any settings.

Some settings can be changed by putting another php.ini in our required folder. In this case the value will be taken from php.ini located in our folder instead of from the root folder.

But it will not be applicable for all the settings. Some settings can not be overridden.

Say for example, display of error message in the browser will be disabled by default in all production environments. But it seems putting this setting should be changed only in the php.ini file available in root folder.

But we may need to see the error message if our webpage is not working properly. We can not ask the shared web hosting company to turn on the error message. Because it will affect other people websites also.

To avoid this issue, the below code can be placed in the php file for enabling the error message display for the particular page.


ini_set("display_errors", 1);

/**Or you can write code as below**/


} else {
ini_set(‘log_errors’, ‘On’);
ini_set(‘error_log’, ROOT.DS.’tmp’.DS.’logs’.DS.’error.log’);


Posted in PHP

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: