Per Directory PHP-Settings under CGI/FastCGI

2 Comments

This one's been a bit under the radar... One of the problems you encounter with PHP via CGI/FastCGI is, that it is quite hard to set per-directory (or per-user) settings. One solution is to set up a separate php.ini for each directory. Of course, that tends to get messy quite soon. And in conjunction with FastCGI it's even a waste of resources...

The LightTPD wiki states that PECL's htscanner extension were a viable solution. Now with v5.3.0 PHP is introducing .user.ini files for the exact same purpose. I am currently toying around with it an am highly statisfied. Any opinions?

Moufle McMittens

Hi there,
Does that .user.ini file allow you to set up important variables like open_basedir? I read that it only allows directives in PHP_INI_PERDIR and PHP_INI_USER modes.

Thanks!

2013-12-30 10:31 am

Da:Sourcerer

Sadly no. .user.ini is confined to altering PHP_INI_PERDIR and PHP_INI_USER variables. If you are on php-fpm, you would need to create a separate pool with a different open_basedir setting.

2014-01-04 3:00 pm