Wednesday, July 29, 2009

How to enable error reporting in php?

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);

More Articles...

No comments:

Search This Blog