最近開啟對 CakePHP 有興趣,所以照著官網的教學來操作
不過,當使用「cake bake」的指令時,卻出現下列的錯誤訊息
Warning: DbConfigTask::bake(): It is not safe to rely on the system's timezone s
ettings. 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 stil
l getting this warning, you most likely misspelled the timezone identifier. We s
elected 'UTC' for '8.0/no DST' instead in E:\UniServer\www\caketest\cake\console
\libs\tasks\db_config.php on line 260
Fatal error: Class 'DATABASE_CONFIG' not found in E:\UniServer\www\caketest\cake
\console\libs\tasks\db_config.php on line 260
原本以為是 PHP 的時區設定有問題,所以開啟「php.ini」,把裡頭的「date.timezone = "Europe/London"」改成「date.timezone = "Asia/Taipei"」,重啟 Apache 後,還是出現一樣的訊息,後來才找出來,原來是 CakePHP 本身也有設定時區,所以必須修改 「./app/config/core.php.」,找到「date.timezone」 的設定,把它解除註解,然後設為自己所在的時區就正常了,我這邊設成「date.timezone = "Asia/Taipei"」
把它記下來,避免下次又忘了!