I can't find PHP.ini location on my server. I've checked all Stack Overflow answers but I can't find my php.ini location.
I have Linux, Cent OS, zPanel. Last version of PHP.
My computer: Linux Mint 15 KDE.
I can't find PHP.ini location on my server. I've checked all Stack Overflow answers but I can't find my php.ini location.
I have Linux, Cent OS, zPanel. Last version of PHP.
My computer: Linux Mint 15 KDE.
In your terminal/console (only Linux, in windows you need Putty)
ssh user@ip
php -i | grep "Loaded Configuration File"
And it will show you something like this Loaded Configuration File => /etc/php.ini
.
ALTERNATIVE METHOD
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".
Update This command gives the path right away
cli_php_ini=php -i | grep /.+/php.ini -oE #ref. https://mcmap.net/q/47710/-where-can-i-find-php-ini
php_ini="${cli_php_ini/cli/apache2}" #replace cli by apache2 ref. https://mcmap.net/q/45307/-replace-one-substring-for-another-string-in-shell-script
php -i | grep "php.ini"
is more easy to remember. ;) –
Bischoff php -i | grep php.ini
is even easier –
Bisexual php -i
tells the php.ini for CLI not the apache's one –
Bury php -i | grep /.+/php.ini -oE
gives exact the path ref –
Bury php: command not found
, I have the Apache module but not the cli. phpinfo()
works well –
Helios On most installs you can find it here:
/etc/php.ini
You can find the path to php.ini
in the output of phpinfo()
. See under "Loaded Configuration File".
php -i |grep 'Configuration File'
© 2022 - 2024 — McMap. All rights reserved.