Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

php

apache

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?

like image 800
patrick.j.goodwin Avatar asked Oct 02 '22 23:10

patrick.j.goodwin


1 Answers

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.

like image 136
Phil Avatar answered Oct 10 '22 23:10

Phil