【背景】
折腾:
【已解决】CentOS 7中查看PHP运行时的Log文件日志信息
期间,需要找到CentOS 7中的php.ini放在哪里了。
【折腾过程】
1.搜:
CentOS7 Apache where php.ini
参考:
Where is my php.ini file? Linux, CentOS – Stack Overflow
去试试:
1 2 3 4 | 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文件的位置:
【总结】
通过执行命令:
1 | php -i | grep "Loaded Configuration File" |
或:
1 2 3 | <?php phpinfo(); ?> |
都可以找到对应的:
Loaded Configuration File
的值,对应的就是php.ini的位置。
比如此处的:
/etc/php.ini