Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I have multiple php.ini files?

I want to set the include_path variable in my php.ini file (C:\Windows\php.ini).

But, I want different include_path values for different sites hosted on the same Windows server. How can I do this?

like image 366
Zack Peterson Avatar asked Jul 16 '26 17:07

Zack Peterson


2 Answers

http://php.net/manual/en/configuration.file.php says:

php.ini is searched for in these locations (in order):

. . .

You can review this list and see if one of the techniques helps in your case. For example, you can set the environment variable PHPRC, or you can put a different php.ini file in each current working directory, assuming each virtual host has a distinct cwd.

Note that when using Apache and mod_php, or other module embedding PHP in the web server (e.g. FastCGI), the php.ini file is read once, at web server startup. When you use PHP in a CGI manner, the php.ini file is read during every web request, so you have more opportunity to use a different php.ini.

like image 156
Bill Karwin Avatar answered Jul 18 '26 08:07

Bill Karwin


You can set the php include_path from an .htaccess file, assuming you have the correct AllowOverride settings in your httpd.conf file. Here's an example how:

.htaccess

php_value include_path "d:\path\to\include"
like image 34
TJ L Avatar answered Jul 18 '26 07:07

TJ L