PHP
1CakePHP is NOT able to connect to the database. 2 3Connection to database could not be established: SQLSTATE[HY000]: General error: 1298 Unknown or incorrect time zone: 'Asia/Tokyo'
cakephp3をインストールしたトップページで上記のエラーが表示されます。
/config/app.php
の'timezone' => 'Asia/Tokyo',を'timezone' => '',
のように、空白にするとエラーは表示されません。
原因不明で気持ちが悪いので、直したいです。
/config/bootstrap.php
PHP
1/* 2 * Set server timezone to UTC. You can change it to another timezone of your 3 * choice but using UTC makes time calculations / conversions easier. 4 */ 5date_default_timezone_set('Asia/Tokyo');
php.ini
PHP
1[Date] 2; Defines the default timezone used by the date functions 3; http://php.net/date.timezone 4date.timezone = Asia/Tokyo
サイトを参考に該当箇所を変更してみたのですが、直りません。。
MySQLは以下のディレクトリにあります。
/opt/local/lib/mysql56/bin/mysqld
✓追記
ーーーーーーーーーーーーーーーーーーーー
/config/app.php
php
1'Datasources' => [ 2 'default' => [ 3 'className' => 'Cake\Database\Connection', 4 'driver' => 'Cake\Database\Driver\Mysql', 5 'persistent' => false, 6 'host' => 'localhost', 7 /** 8 * CakePHP will use the default DB port based on the driver selected 9 * MySQL on MAMP uses port 8889, MAMP users will want to uncomment 10 * the following line and set the port accordingly 11 */ 12 //'port' => 'non_standard_port_number', 13 'username' => 'root', 14 'password' => 'pass', 15 'database' => 'sample', 16 'encoding' => 'utf8', 17 'timezone' => Asia/Tokyo, 18 'flags' => [], 19 'cacheMetadata' => true, 20 'log' => false, 21
のように
'timezone' => 'Asia/Tokyo',を'timezone' => Asia/Tokyo
に変更したところ、エラーはでませんでした。
このままで大丈夫なのでしょうか?
できれば、エラーの原因含め教えていただけると助かります><
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/11/12 12:28