What are the .ini files in /etc/php5/conf.d folder for? What are the .ini files in /etc/php5/conf.d folder for? linux linux

What are the .ini files in /etc/php5/conf.d folder for?


Those files will overwrite the settings in php.ini. Putting config stuff here allows you to have custom settings while keeping updates simpler: if you modify php.ini itself then you either have to retain the old php.ini or overwrite it when you update PHP. If you keep your custom settings in, eg. conf.d/local.ini then you can update PHP easily while retaining any environment-specific settings.

(Credit due to this blog post)


From /usr/share/doc/php5-common/README.Debian.gz (on an Ubuntu system with PHP installed):

Additionally, each SAPI is configured with the compile-time option

    --with-config-file-scan-dir=/etc/php5/$SAPI/conf.d

which for all SAPI's is actually a symlink pointing to a central directory /etc/php5/conf.d. Any file found in this directory ending in .ini will be treated as a configuration file by the php SAPI.

The rationale with this method is that each SAPI can thus be identically configured with a minimal amount of conffile handling, but at the same time if you want to have SAPI-specific configuration, you can just remove the symlink.