CentOS 7中PHP配置文件php.ini的放在哪个位置

2025-04-07 15:41:38
推荐回答(2个)
回答1:

  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文件的位置:
  【已解决】CentOS 7中PHP配置文件php.ini的放在哪个位置
  【总结】
  通过执行命令:
  php -i | grep "Loaded Configuration File"
  或:
  
  都可以找到对应的:
  Loaded Configuration File
  的值,对应的就是php.ini的位置。
  比如此处的:
  /etc/php.ini
  本文开发(php)相关术语:php代码审计工具 php开发工程师 移动开发者大会 移动互联网开发 web开发工程师 软件开发流程 软件开发工程师
  主题: PHP、Linux、UT、UTC、

回答2:

利用whereis php 会看到有个 /etc/php 配置文件就在那里