Using "auto_prepend_file" into ".user.ini" file in PHP
ini, php
Solution
Well, the manual says it all:
Since PHP 5.3.0, PHP includes support for configuration INI files on a per-directory basis. These files are processed only by the CGI/FastCGI SAPI. This functionality obsoletes the PECL htscanner extension.
And:
If you are using Apache, use .htaccess files for the same effect.
... though it actually refers to the Apache module (`mod_php`).
If you need SAPI-independent custom settings I'm afraid you'll have to use both. You can minimise the maintenance burden if you keep those settings to the minimum (most PHP directives can be provided in PHP code itself). And you need to ensure that `.htaccess` settings don't crash when `mod_php` is not available:
<IfModule mod_php5.c>
php_value auto_prepend_file /Volumes/www/project_name/admin/libs/variables.php
</IfModule>
Problem
I want to load the file `variables.php` (that simply contains variables) at the run of any pages of my project so I can use the variables from any place. I created a file called `.user.ini` (and placed it in the root folder): ``` ; Automatically add files before PHP document. ; http://php.net/auto-prepend-file auto_prepend_file = /Volumes/www/project_name/admin/libs/variables.php ``` It doesn't work. It seems that PHP doesn't read the .user.ini file. php.ini is right configured by default: ``` user_ini.cache_ttl 300 300 user_ini.filename .user.ini .user.ini ``` Where am I wrong?