PHP .user.ini - thehazels PHP .user.ini - thehazelsthehazels

PHP .user.ini

Just discovered a great new feature of PHP 5.3. .user.ini can override the main php.ini directives. Anything not classified as PHP_INI_SYSTEM in the List of php.ini directives can be set here and used locally.

I’ve found it very useful for error reporting. On my development sites, I want to be able to see all errors immediately – including those at NOTICE level which can get forgotten in a log file. However, this is not acceptable on a production site and my web hosting company, quite rightly, has the main php.ini display levels set to off, with all errors logged to the error log. So all I have to do in .user.ini is:

display_errors = On
display_startup_errors = On

I did think about setting them using the PHP function error_reporting(), however, this would still show the ‘white screen of death’ since the PHP script would have failed before error_reporting() was run.

About Antonia Whitaker

An administrative, sales and marketing background has given me an understanding of what users want from their website. I do not confuse issues with technical jargon and I listen to what people want.

14. November 2014 by Antonia Whitaker
Categories: Tools | Tags: | Leave a comment

Leave a Reply

Required fields are marked *