Linux/CentOS PC上的php.ini文件在哪里? [英] Where is the php.ini file on a Linux/CentOS PC?

查看:118
本文介绍了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的内容.

替代方法

您可以在您的网站上制作一个php文件,该文件运行:<?php phpinfo(); ?>,并且您可以在一行中看到php.ini位置:已加载的配置文件" .

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://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文件在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆