Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I include a php.ini file in another php.ini file?

How do I include a php.ini file in another php.ini file?

like image 454
Itay Moav -Malimovka Avatar asked Sep 08 '09 03:09

Itay Moav -Malimovka


People also ask

How do I use a different PHP ini file?

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.

Is PHP ini development the same as PHP ini?

As name suggests, php. ini-development contains settings suitable for development environment and php. ini-production contains settings suitable for production environment.


2 Answers

I don't think you can "include" .ini files from the main php.ini file.

One possible solution, though, might be to use this option on the configure line, when compiling PHP:

--with-config-file-scan-dir=PATH     Set the path where to scan for configuration files 

If this option is used at compile-time, PHP will look for every .ini file in this directory, in addition to the "normal" php.ini file.

I suppose this is what is used by Ubuntu, for instance, which uses a different .ini file for each downloaded extension, instead of modifying php.ini.

The path to the php.ini file is being defined with this option, on the configure line:

--with-config-file-path=PATH     Set the path in which to look for php.ini [PREFIX/lib] 

Still, it probably means you'll have to re-compile PHP -- which is not that hard, btw -- the hardest part being to get the dependencies you need.

And, here is a post on the internals@ mailling-list that says the same thing as I do: config files and PHP_CONFIG_FILE_SCAN_DIR

like image 197
Pascal MARTIN Avatar answered Sep 18 '22 00:09

Pascal MARTIN


One can also define the path in ~/.bashrc

export PHP_INI_SCAN_DIR=/usr/local/lib/php.d 
like image 20
Martin Zeitler Avatar answered Sep 20 '22 00:09

Martin Zeitler