CakePHP2.5.2のインストール

KAGOYA/VPSサーバにCakePHP2.5.2をインストールします。

(注意)
「test.jp」ドメインでブラウザからアクセスできる設定が出来ていることが前提での記述です。
apache、PHP、MySQLの設定については今回の説明には記述していません。

■CakePHP2.0ダウンロード
「http://cakephp.org/」サイト右上の「Download」ボタンからダウンロードします。
Windows上デスクトップに「cakephp-cakephp-2.5.2-0-g96df2c4.zip」ファイルが作成されます。

■ダウンロードファイルの解凍
デスクトップ上で解凍すると「cakephp-cakephp-736e999」フォルダに解凍されます。

■CakePHP2.0インストール
今回はサーバ上の「/var/www/test」ディレクトリにインストールします。
WinSCPでWindowsのデスクトップから「cakephp-cakephp-736e999」フォルダをサーバの/var/www/ディレクトリにアップロードします。
アップロード後ディレクトリ名を「cakephp-cakephp-736e999」から「test」に変更します。

■CakePHP設定
・「tmp」ディレクトリのパーミッション変更
# chmod -R 0777 /var/www/test/app/tmp

■暗号化設定
「/var/www/test/app/Config/core.php」を下記のように変更します。
今回はディフォルト設定の前に「TEST」と「9999」を追加しましたが、好きな文字列に変更してください。

/**
* A random string used in security hashing methods.
*/
//Configure::write(‘Security.salt’, ‘DYhG93b0qyJfIxfs2guVoUubWwvniR2G0FgaC9mi’);
Configure::write(‘Security.salt’, ‘TESTDYhG93b0qyJfIxfs2guVoUubWwvniR2G0FgaC9mi’);

/**
* A random numeric string (digits only) used to encrypt/decrypt strings.
*/
//Configure::write(‘Security.cipherSeed’, ‘76859309657453542496749683645’);
Configure::write(‘Security.cipherSeed’, ‘999976859309657453542496749683645’);

■データベース設定
「/var/www/test/app/Config/database.php.default」を「/var/www/test/app/Config/database.php」にコピーします。
$defaultのlogin、password、databaseを変更します。
$testのlogin、password、databaseを変更します。

▼設定変更内容
login:データベース接続ログインID
password:データベース接続パスワード
database:データベース名
▲設定変更内容

■TOPページ表示
ブラウザから「http://test.jp」にアクセスにTOPページを表示させます。

■画面上部に下記エラーが出た時の設定
「/var/www/test/app/Config/core.php」の「date_default_timezone_set(‘UTC’);」行のコメントをはずします。

▼エラー内容
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 ‘Asia/Tokyo’ for ‘JST/9.0/no DST’
instead in /var/www/test/lib/Cake/Cache/CacheEngine.php on line 60 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 ‘Asia/Tokyo’ for ‘JST/9.0/no DST’
instead in /var/www/test/lib/Cake/Cache/CacheEngine.php on line 60
▲エラー内容

■テンプレートの文字化け
テンプレートを保存するときに文字コードを「UTF-8」改行コードを「LF」にします。

■DBから読みだした値が文字化けする対応
「/var/www/test/app/Config/database.php」の「’encoding’ => ‘utf8’,」のコメントをはずします。



This entry was posted in CakePHP. Bookmark the permalink.

Comments are closed.