There are several valid ways already mentioned for locating the php.ini file, but if you came across this page because you want to do something with it in a bash script:
path_php_ini="$(php -i | grep 'Configuration File (php.ini) Path' | grep -oP '(?<=\=\>\s).*')"
echo ${path_php_ini}