问题描述
我在我的服务器上找不到 PHP.ini 位置.我检查了所有 Stack Overflow 答案,但找不到我的 php.ini 位置.
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.
我有 Linux、Cent OS、zPanel.PHP 的最新版本.
I have Linux, Cent OS, zPanel. Last version of PHP.
我的电脑:Linux Mint 15 KDE.
My computer: Linux Mint 15 KDE.
推荐答案
在你的终端/控制台中(只有 Linux,在 windows 中你需要 腻子)
In your terminal/console (only Linux, in windows you need Putty)
ssh user@ip
php -i | grep "Loaded Configuration File"
它会显示类似这样的内容 Loaded Configuration File =>/etc/php.ini
.
And it will show you something like this Loaded Configuration File => /etc/php.ini
.
替代方法
你可以在你的网站上创建一个php文件,运行:<?php phpinfo();?>
,可以看到php.ini的位置在一行:"Loaded Configuration File".
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".
更新该命令立即给出路径
cli_php_ini=php -i | grep /.+/php.ini -oE #ref. https://stackoverflow.com/a/15763333/248616
php_ini="${cli_php_ini/cli/apache2}" #replace cli by apache2 ref. https://stackoverflow.com/a/13210909/248616
这篇关于Linux/CentOS PC 上的 php.ini 文件在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!