PHP - config file location

Method 1

Create info.php with code above and open the file in your browser

<?php
phpinfo();

You will see the path to the php.ini like in the following screenshot

php config file location

Method 2

For Linux based OS

php -i | grep "Loaded Configuration File"

For Windows

php -i | findstr /c:"Loaded Configuration File"

Output should be something like this

Loaded Configuration File => /etc/php/7.2/cli/php.ini