Set PHP config Variables (like ini_set) with .htaccess

October 26, 2018

If you need to set some PHP config variables (the same as in php.ini or via ini_set()) you can do this in .htaccess

php_value upload_max_filesize 150M
php_value  include_path  ".:/usr/local/lib/php"
php_value error_log  "/log/location/php_errors.log"

If you need to switch something from on to off (true/false) then you must use php_flag:

php_flag display_errors off

If apache is run in CGI mode this will not work.