php -i |grep php.ini
Alternatively you can create a new php file and use the following:
<? phpinfo();?>
Open this file in your browser and you will be able to find your php.ini file.
With WHM / cPanel based servers your php.ini file will be at /usr/local/lib/php.ini
Your edits to this file will not be overwritten.