jump to navigation

Hide PHP errors Using htaccess November 7, 2011

Posted by Tournas Dimitrios in PHP.

PHP contains many levels of error reporting and it is a very useful addition in the developers tool kit . By reporting runtime errors , error reporting lets the developer know what problem has occured , the path name and file name of the script that has the error , the function name that has possibly caused the error and the line number on which the error occured . Should a malicious user succeed in causing an error on a site ,  all this information about the system is gained from the error output . To remedy this , the php.ini setting display_errors  (dispsplay_errors = 0 ) should be turned off (it is even stated in the manual that it is not recommended to enable this feature on a production site  ) . This ensures if any sort of error occurs , no output is generated and potentially giving “black-hackers” a free ride . If this setting is not turned off in php.ini , it can be turned off on a per script basis at runtime with the ini_set() function as follows . 
ini_set(‘display_errors’ , 0 ) ;

To entirely disable or switch it off (assuming that you’re on a shared hosting which have limited super power) , simply add  php_flag display_errors off   in your .htaccess file.




1. plumbers in manchester - November 14, 2011

Oh my goodness! a tremendous article dude. Thank you Nevertheless I am experiencing concern with ur rss . Don’t know why Unable to subscribe to it. Is there anybody getting equivalent rss problem? Anyone who knows kindly respond. Thnkx

tournasdimitrios1 - November 14, 2011

Hi ,
Welcome to this Blog and thanks for you feedback .
This Blog supports two rss feeds ( the native WordPress and FeedBurner’s )
Which rss is causing the problem ?
Alternatively you can follow my articles on Twitter .

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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