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
Discuss the article:

Comment anonymously. Login not required.