2015-12-13 52 views
-1

我得到一個錯誤訊息----------時區錯誤安裝腳本後

Warning: date(): 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 /home/user/public_html/cdemo/_include/lib/lib.php on line 73 

Warning: date(): 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 /home/user/public_html/cdemo/_include/lib/lib.php on line 74 



Error: E_WARNING 
URL: http://mywebsite.com/demo/ 
File: /home/user/public_html/cdemo/_include/lib/db_common.php 
Line: 69 
Message: date(): 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. 

Call stack: 

File: /home/user/public_html/cdemo/_include/lib/db_common.php (Line: 69) 
Function: date 

File: /home/user/public_html/cdemo/_include/core/start.php (Line: 199) 
Class: DB_Common 
Function: connect 

File: /home/user/public_html/cdemo/_include/core/main_start.php (Line: 12) 
Function: include 

File: /home/user/public_html/cdemo/index.php (Line: 15) 
Function: include 

enter image description here

如何解決這個問題?

+0

$ sql ='SET SESSION'sql_mode' =「」,NAMES「utf8」,SESSION collat​​ion_connection =「utf8_unicode_ci」,time_zone =「Indian/Cocos'。date('P')。'''; –

+0

db_common.php文件中我的database_common目錄中有一行 –

回答

0

有兩種方法來解決這個問題:

  1. 在腳本(或你的MVC框架的入口文件)的頂部使用內置函數date_default_timezone_set(timezone_of_your_place)。您可以在timezone_list中找到代表您所在位置時區的常量。

  2. php.ini更改配置項目date.timezone = your_timezone

這兩者的區別是,方法1將立即但隻影響該腳本的續航時間,而方式2將影響所有PHP腳本行爲重新加載PHP配置文件之後。

+0

b_common.php Line:46 消息:無法執行查詢:未知或不正確的時區:'Asia/Calcutta + 05:30'SET SESSION'sql_mode '=「」,NAMES「utf8」,SESSION collat​​ion_connection =「utf8_unicode_ci」,time_zone =「Asia/Calcutta + 05:30」 –

+0

現在我從這行刪除並放入php.ini並工作。 –