Why do we have a different php.ini for the php client ?

Is it a good idea to link the main instead ?

$ sudo ln -s /etc/php5/apache2/php.ini /etc/php5/cli/php.ini

It entirely up to you how you configure your system, based on your needs. However, there are good reasons for having separate configuration files for CLI and Apache, not least because a web server is typically an externally facing service. For example:

  • Disabling some extensions to minimise security risks.
  • Configuring lower memory limits to limit the potential for denial of service attacks.

Note that you can also configure your PHP installation by adding files to /etc/php5/conf.d. This is a good way to keep your customisations in their own file and avoid conflicts in your php.ini file(s) if they get updated by a new version of the packages. The latter point is also an issue if you choose to use symlinks for php.ini. Note that the conf.d directories for cli and apache are symlinks.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.