Seperate php.ini config file per vhost
Added by JustinK101 over 14 years ago
Is it possible to have separate php.ini configuration file for a vhost/host?
Something like:
$HTTP["host"] == "mydomain.com" {
php_ini = "/etc/php/users/bob/php.ini"
}
Replies (4)
RE: Seperate php.ini config file per vhost - Added by carpii over 14 years ago
Lighty knows nothing about PHP really.. It usually just speaks to PHP as a standard fastcgi backend (or less commonly as cgi)
You could try http://pecl.php.net/package/htscanner, but it depends what ini settings you want to change
Another solution is to spawn the fcgi's outside of lighty (maybe using the spawn-fcgi script?), and have requests talk to a different fcgi socket depending on the host.
You can also allow some ini settings to be overriden in your script using PHP's ini_set(), which might be suitable in some situations
RE: Seperate php.ini config file per vhost - Added by radzio over 14 years ago
Try php fpm.
http://www.php.net/manual/en/install.fpm.php
RE: Seperate php.ini config file per vhost - Added by stbuehler over 14 years ago
You could try [HOST=mydomain.com]
(or [PATH=...]
) sections in the php.ini, see http://www.php.net/manual/en/ini.sections.php
Another way could be .user.ini files: http://www.php.net/manual/en/configuration.file.per-user.php (i think this is better than htscanner)
Both are new since PHP 5.3.0.
RE: Seperate php.ini config file per vhost - Added by JustinK101 over 14 years ago
stbuehler,
Thanks very much; http://www.php.net/manual/en/configuration.file.per-user.php is exactly what we need. We were not aware this was supported at the PHP level.