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

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

Leave a Comment