除美灭日平韩 发表于 2013-06-13 13:35

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的信息
俺凌乱了。。。
什么情况。。

shang2010 发表于 2013-06-13 15:22

不了解啊,php也是新手入门

除美灭日平韩 发表于 2013-06-13 16:51

查到了问题
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目录下成功了
我擦,谁能告诉我,为什么。。。!!!

shang2010 发表于 2013-06-13 17:08

你这是自己编译安装的啊

除美灭日平韩 发表于 2013-06-13 17:08

回复 4# shang2010
难道还有自动编译安装?!

   

shang2010 发表于 2013-06-13 17:09

难道你不会???;P

除美灭日平韩 发表于 2013-06-13 17:10

回复 6# shang2010

我只知道可以yum
   

shang2010 发表于 2013-06-13 17:11

回复 7# 除美灭日平韩


    会一个就行了,,,

除美灭日平韩 发表于 2013-06-13 17:12

回复 8# shang2010

比较喜欢手动编译安装
不喜欢yum
   

ydlhero 发表于 2013-06-14 12:02

需要php.ini 设置时区
页: [1] 2
查看完整版本: LNMP环境的时区问题?!