最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【已解决】CentOS 7中PHP配置文件php.ini的放在哪个位置

PHP crifan 18903浏览 0评论

【背景】

折腾:

【已解决】CentOS 7中查看PHP运行时的Log文件日志信息

期间,需要找到CentOS 7中的php.ini放在哪里了。

 

【折腾过程】

1.搜:

CentOS7 Apache where php.ini

参考:

Where is my php.ini file? Linux, CentOS – Stack Overflow

去试试:

root@chantyou:~# php -i | grep "Loaded Configuration File"
Loaded Configuration File => /etc/php.ini
PHP Warning:  Unknown: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in Unknown on line 0
root@chantyou:~# 

即:

/etc/php.ini

2.另外,也注意到:

通过phpinfo()的输出,也可以看到php.ini文件的位置:

phpinfo also show php ini file location

 

【总结】

通过执行命令:

php -i | grep "Loaded Configuration File"

或:

<?php
   phpinfo();
?>

都可以找到对应的:

Loaded Configuration File

的值,对应的就是php.ini的位置。

比如此处的:

/etc/php.ini

转载请注明:在路上 » 【已解决】CentOS 7中PHP配置文件php.ini的放在哪个位置

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
82 queries in 0.158 seconds, using 22.17MB memory