时区和更多的问题与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选择了Europe / Berlin,而不是[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致命错误:调用成员函数cd()对非对象在/htdocs/cakephp/cake/libs/cache/file.php行248& / 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中的时区定义为Europe / London
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...
UPDATE:我安装的php ...有问题...如果我运行
UPDATE: something is wrong with my installation of php... if i run
<?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屋!