PHP configuration files

PHP's configuration file location might differ from one platform to another. Here's an incomplete list of the possible location for PHP's configuration file;

Platform Location
xampp {installation directory}/php/php.ini
macOS /private/etc/php.ini
Ubuntu < 16.10 /etc/php5/{cli,apache2,cgi}/php.ini
Ubuntu >= 16.10 /etc/php7/{cli,apache2,cgi}/php.ini
Ubuntu >= 18.04 /etc/php/{version}/{cli,apache2,cgi}/php.ini
RedHat/CentOS/Fedora /etc/php.ini

If you're on a Unix based operating system, you can run php -i from the terminal and look for Loaded Configuration File from the output to get the location for your exact system such as the following;

$ php -i | grep 'Loaded Configuration File'
Loaded Configuration File => /etc/php.ini

Sign up for Object Oriented PHP & MVC and many other great courses on Udemy to learn more.

Object Oriented PHP & MVC

Build a custom object oriented PHP MVC framework and then build an application with it!

Written by Mohd Shakir Zakaria. Last updated on 2019-03-07