Php.ini strftime()不安全Mac osx mavericks

时间:2014-04-16 07:54:30

标签: php macos

我在运行mavericks的mac上使用php + smarty时遇到错误。

我在几个地方读到你必须更改php.ini文件中的时区设置。

我还运行命令以查看php指向的文件:

php -i | grep 'Configuration File'
Configuration File (php.ini) Path => /etc
Loaded Configuration File => /etc/php.ini

之后我将date.timezone行更改为以下内容......

date.timezone = "Australia/Sydney"

这是在文件中完成的

/etc/php.ini中 /etc/php.ini-5.2-previous /etc/php.ini.default

错误如下......

Warning: strftime(): 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 /Library/Smarty3.1.16/libs/sysplugins/smarty_internal_templatecompilerbase.php on line 234

1 个答案:

答案 0 :(得分:0)

对于那些仍在疑惑的人。

同样,在我的案例中,Yosemite OS,我在/ etc中没有php.ini文件。所以我复制了/etc/php.ini.default并通过添加时区并删除来修改它;

$ sudo cp /etc/php.ini.default /etc/php.ini

然后:

date.timezone = America/Los_Angeles