Skip to content
Advertisement

Turn off display errors using file “php.ini”

I am trying to turn off all errors on my website. I have followed different tutorials on how to do this, but I keep getting read and open error messages. Is there something I am missing?

I have tried the following in my php.ini file:

JavaScript

For some reason when I do a fileopen() call for a file which does not exist, I still get the error displayed. This is not safe for a live website, for obvious reasons.

Advertisement

Answer

I always use something like this in a configuration file:

JavaScript

This allows easy toggling between debug settings. You can improve this further by checking on which server the code is running (development, test, acceptance, and production) and change your settings accordingly.

Note that no errors will be logged if error_reporting is set to 0, as cleverly remarked by Korri.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement