时区和Cakephp 1.3和PHP 5.3.2的更多问题 [英] Timezone and more problems with Cakephp 1.3 and PHP 5.3.2
问题描述
在服务器上我有php 5.3.2和cakephp 1.3。
on server i have php 5.3.2, and cakephp 1.3.
当我运行cakephp应用程序,它给我以下错误:
when i run cakephp application, it gives me following errors:
警告(2):strtotime()[ http: //php.net/function.strtotime] :依靠系统的时区设置是不安全的。您需要 使用date.timezone设置或date_default_timezone_set()函数。如果您使用任何这些方法,并且您仍然收到此警告,您很可能拼写时区标识符。我们为'CEST / 2.0 / DST'选择'欧洲/柏林'[ROOT / cakephp / cake / libs / cache.php,第570行]
Warning (2): strtotime() [http://php.net/function.strtotime]: 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 'Europe/Berlin' for 'CEST/2.0/DST' instead [ROOT/cakephp/cake/libs/cache.php, line 570]
另外,我得到一些更多的错误:
Also, I'm getting some more errros:
注意:尝试获取/ htdocs中的非对象的属性/cakephp/cake/libs/cache/file.php on line 248致命错误:在第248行的/htdocs/cakephp/cake/libs/cache/file.php中的非对象上调用成员函数cd() / p>
Notice: Trying to get property of non-object in /htdocs/cakephp/cake/libs/cache/file.php on line 248 Fatal error: Call to a member function cd() on a non-object in /htdocs/cakephp/cake/libs/cache/file.php on line 248
php.ini中的时区定义为欧洲/伦敦
Timezone in php.ini is defined as Europe/London
尽管我定义了 date_default_timezone_set('UTC')
,或欧洲/伦敦,或任何...
I'm always getting that error, despite I define or not date_default_timezone_set('UTC')
, or Europe/London, or whatever...
真的很沮丧.........请帮助...
really frustrating......... please help...
更新:如果我运行
<?php echo date('Y'); ?>
...它给我空白屏幕。没有结果...
... it gives me blank screen. no result...
可能有问题吗?
推荐答案
要处理第一个警告,您需要取消注释/app/config/core.php中的 date_default_timezone_set('UTC');
行。您可以按照Leo的建议将您的时区替换为 UTC
。
To handle the first warning you need to uncomment the line date_default_timezone_set('UTC');
in /app/config/core.php. You can replace UTC
with your timezone as Leo suggested.
这篇关于时区和Cakephp 1.3和PHP 5.3.2的更多问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!