バージョン
cakephp 2.6.7
DocumentRootの設定とディレクトリ構造の変更
マルチドメインの設定|さくらインターネット公式サポートサイトのような感じで、DocumentRootを設定して、
vagrantその21 cakephpのディレクトリ構造を変更して、webrootだけを公開ディレクトリに配置する - MOTOMICHI WORKS BLOGを見つつ、cakephpのディレクトリ構造を適当に変更してサーバに配置した。
このままだと、DocumentRootだけは表示できるんだけど、http://hoge.js/Controller/Actionみたいな感じで、ControllerとActionを設定しても、
Not Found
The requested URL /Members/accept was not found on this server.
Apache/2.2.15 (CentOS) Server at utility.localhost.uh-oh Port 80
と表示されてしまう。
このController/Actionが機能しない問題については、以下の記事で解決されることとなった。
さくらのレンタルサーバスタンダードとcakephpで開発その0006 Controllerを認識していないようなので、.htaccessを設置して解消する - MOTOMICHI WORKS BLOG
タイムゾーンを設定する
最初は
Warning: 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 the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /home/ユーザー名/cakephp/lib/Cake/Cache/CacheEngine.php on line 60
のような警告が出ているので、php.iniまたはCacheEngine.phpでタイムゾーンを設定しておく必要がある。
CakePHPのダウンロードとインストール - CakePHPの使い方を参考に、タイムゾーンを設定した。
cakephp 2.6.7だと、CacheEngine.phpの39行目から63行目あたりの以下の部分がそれにあたると思う。
/**
* Initialize the cache engine
*
* Called automatically by the cache frontend
*
* @param array $settings Associative array of parameters for the engine
* @return bool True if the engine has been successfully initialized, false if not
*/
public function init($settings = array()) {
$settings += $this->settings + array(
'prefix' => 'cake_',
'duration' => 3600,
'probability' => 100,
'groups' => array()
);
$this->settings = $settings;
if (!empty($this->settings['groups'])) {
sort($this->settings['groups']);
$this->_groupPrefix = str_repeat('%s_', count($this->settings['groups']));
}
if (!is_numeric($this->settings['duration'])) {
$this->settings['duration'] = strtotime($this->settings['duration']) - time();
}
return true;
}
$this->settings['duration'] = strtotime($this->settings['duration']) - time();の上に下記の一行を追記した。
date_default_timezone_set('Asia/Tokyo');
これでWarningが消えた。