I get that the .ini files in /etc/php5/cli
have to do with CLI usage of PHP, the files in /etc/php5/fpm
are about FastCGI/FPM aspect of PHP, but what about the .ini files located in /etc/php5/conf.d
?
问题:
回答1:
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.
回答2:
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)