用户名: 密码: 忘记密码? 注册
收藏此问题 发表新评论

LNMP环境的时区问题?!

编译安装了LNMP,一切正常
查看phpinfo
提示了
Warning: phpinfo(): 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 /opt/nginx/html/index.php on line 2

phpinfo可以看到
Configuration File (php.ini) Path         /usr/local/php/etc

于是跑去设置时区为PRC(Asia/Shanghai也试了),连机器都重启了,不行!
但是,在PHP代码里加date_default_timezone_set("Asia/Shanghai");即可!
然后我把这个目录下的php.ini删了,重启机器
竟然还能看到phpinfo的信息
俺凌乱了。。。
什么情况。。
昵称: 除美灭日平韩  时间: 2013-06-13 13:34:37
查到了问题
strace  /usr/local/php/bin/php -i 2> /tmp/1.log
grep 'php.ini' /tmp/1.log
显示如下:
open("/usr/local/php/bin/php.ini", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/php.ini", O_RDONLY) = -1 ENOENT (No such file or directory)
write(1, "Configuration File (php.ini) Pat"..., 33) = 33
发现php查找的php.ini是在那两个目录
然后我一个个试,终于把php.ini放在/usr/local/lib目录下成功了
我擦,谁能告诉我,为什么。。。!!!
昵称: 除美灭日平韩  时间: 2013-06-13 16:47:22
发表评论
昵称:
内容:
验证: