Linux/CentOS PC 上的 php.ini 文件在哪里?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17850787/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Where is the php.ini file on a Linux/CentOS PC?
提问by MM PP
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.
我在我的服务器上找不到 PHP.ini 位置。我已经检查了所有 Stack Overflow 的答案,但我找不到我的 php.ini 位置。
I have Linux, Cent OS, zPanel. Last version of PHP.
我有 Linux、Cent OS、zPanel。最新版本的 PHP。
My computer: Linux Mint 15 KDE.
我的电脑:Linux Mint 15 KDE。
采纳答案by NETCreator Hosting
In your terminal/console (only Linux, in windows you need Putty)
在您的终端/控制台中(仅限 Linux,在 Windows 中您需要Putty)
ssh user@ip
php -i | grep "Loaded Configuration File"
And it will show you something like this Loaded Configuration File => /etc/php.ini
.
它会向你展示这样的东西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".
您可以在您的网站上制作一个 php 文件,该文件运行:<?php phpinfo(); ?>
,您可以在一行中看到 php.ini 位置:“加载的配置文件”。
UpdateThis command gives the path right away
更新此命令立即给出路径
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
回答by Hein Andre Gr?nnestad
You can find the path to php.ini
in the output of phpinfo()
. See under "Loaded Configuration File".
您可以php.ini
在phpinfo()
. 参见“加载的配置文件”。
回答by srain
php -i |grep 'Configuration File'
回答by Randeep
#php -i | grep php.ini
also will work too!
#php -i | grep php.ini
也将工作!
回答by TheRealJAG
On most installs you can find it here:
在大多数安装中,您可以在此处找到它:
/etc/php.ini
/etc/php.ini