Where is the php.ini file on a Linux/CentOS PC?(Linux/CentOS PC 上的 php.ini 文件在哪里?)
问题描述
我在我的服务器上找不到 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 文件在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Linux/CentOS PC 上的 php.ini 文件在哪里?


- 如何定位 php.ini 文件 (xampp) 2022-01-01
- Laravel 仓库 2022-01-01
- 带有通配符的 Laravel 验证器 2021-01-01
- Oracle 即时客户端 DYLD_LIBRARY_PATH 错误 2022-01-01
- PHP Count 布尔数组中真值的数量 2021-01-01
- 从 PHP 中的输入表单获取日期 2022-01-01
- 正确分离 PHP 中的逻辑/样式 2021-01-01
- SoapClient 设置自定义 HTTP Header 2021-01-01
- Mod使用GET变量将子域重写为PHP 2021-01-01
- 没有作曲家的 PSR4 自动加载 2022-01-01