patrick.j.goodwin
patrick.j.goodwin

Reputation: 105

When do ini files in /etc/php.d/ get loaded?

In the load order of Apache, when in the order of PHP .ini files are the files that are are in /etc/php.d/ loaded? I know for httpd itself, .conf files located in /etc/httpd/conf.d/ are loaded when the Apache include ... directive in the httpd.conf file is called. Are .ini files located in /etc/php.d/ loaded after the entire /etc/php.ini file is loaded, or is there an include in /etc/php.ini that loads the file at a certain point?

Upvotes: 5

Views: 4870

Answers (1)

Phil
Phil

Reputation: 2313

This is nothing to do with Apache. The loading of PHP ini files depends on how your PHP binary is compiled. You can configure the option --with-config-file-scan-dir to point to a directory at compile time.

--with-config-file-scan-dir=/etc/php.d

You do not need to add anything to your php.ini. All .ini files in this directory will be loaded in alphabetical order after the initial configuration file has been loaded. This configure switch can also be overridden by setting an environment variable.

Note: To prevent this behaviour when using PHP CLI, you can use the switch -n on the php binary to turn off dynamic loading of ini files.

Upvotes: 4

Related Questions