Where is the php.ini file on a Linux/CentOS PC?

Where is the php.ini file on a Linux/CentOS PC?

In your terminal/console (only Linux, in windows you need Putty)

n

ssh [email protected] -i | grep Loaded Configuration Filen

n

And it will show you something like this Loaded Configuration File => /etc/php.ini.

n

ALTERNATIVE METHOD

n

You can make a php file on your website, which run: <?php phpinfo(); ?>, and you can see the php.ini location on the line with: Loaded Configuration File.

n

UpdatenThis command gives the path right away

n

cli_php_ini=php -i | grep /.+/php.ini -oE  #ref. https://stackoverflow.com/a/15763333/248616n    php_ini=${cli_php_ini/cli/apache2}   #replace cli by apache2 ref. https://stackoverflow.com/a/13210909/248616n

You can find the path to php.ini in the output of phpinfo(). See under Loaded Configuration File.

n

enter

Where is the php.ini file on a Linux/CentOS PC?

On most installs you can find it here:

n

/etc/php.ini

Leave a Reply

Your email address will not be published.