Script to locate php.ini

Simple script to locate php.ini file from your directory.

Save this script in a php file let’s say locate-php-ini.php. Access the file from your local server. It will show exact path location.
$inipath = php_ini_loaded_file();

if ($inipath) {
echo 'Loaded php.ini: ' . $inipath;
} else {
echo 'A php.ini file is not loaded';

Output would be like: Loaded php.ini: /Applications/XAMPP/xamppfiles/etc/php.ini