: How to use different php.ini files for different VirtualHosts? I have my site and it's staging subdomain running on the same CentOS machine running apache. The subdomain is created using a VirtualHost,
I have my site and it's staging subdomain running on the same CentOS machine running apache. The subdomain is created using a VirtualHost, and I use it to find any bugs before I push to production. I want the php.ini file for the staging VirtualHost to be a development one, and the production site will use a production php.ini. How can I configure apache to use different php.ini files? I don't want to use php_value/php_flag for everything, I'd rather just use the php.ini file I already have available. I've tried creating an .htaccess file that looks like this,
SetEnv PHPRC /path/to/php.ini/directory
This has no effect, as phpinfo() tells me it's still using /etc/php.ini. I've also tried setting PHPIniDir for both virtual hosts (www and staging) and it complains about seeing the directive twice.
More posts by @Angela700
1 Comments
Sorted by latest first Latest Oldest Best
Actually, it is impossible to specify different php.ini files for each virtual host.
However you can change almost anything in the php.ini file by using the ini_set() function:
It allows you to set the value of a given configuration option. The configuration option will keep this new value during the script's execution, and will be restored at the script's ending.
Not all the available options can be changed using ini_set(). There is a list of all available options here. Thus, all directives having the "PHP_INI_USER" mode can be changed during runtime by using the ini_set() function.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.