開発メモ,主に補足by子連れ親父プログラマー

2011-09-05

CakePHP1.3で作る会員管理システム(2) CakePHPの設置

CakePHPの設置

本家サイトからダウンロードした CakePHP を設置します。
「Download」の画像をクリックするとgithub のページに飛ぶので、そちらから、 1.3.11.zip — 1.3.11 をクリックします。

ダウンロードしたファイルを解凍すると、 cakephp-cakephp-3b830a4 という名前のフォルダーが出来るので、これを cake とリネームしてローカル環境のドキュメントルート以下にコピーします。
MacOSXの場合は、いわゆる「サイト」フォルダー

/Users/myname/Sites
以下ということになります。

Windows の場合は、apache をどこにインストールしたかにもよるんでしょうが、その htdocs 以下、ということです。例えば、

c:¥Program Files¥apache・・・・¥htdocs
になるかと思います。
本番リリースと同じ構造にしておく、という手もありますが、開発用のローカル環境ではなにもいじらない方がやりやすいんじゃないですかね。
なにしろ、まっさらの状態でも本体をダウンロードしてきてそのまま始められる訳ですから。

で、 http://localhost/~myname/cake/ をブラウザから開きます。

Warning (512): /Users/myname/Sites/cake/app/tmp/cache/ is not writable [CORE/cake/libs/cache/file.php, line 267]
Warning (512): /Users/myname/Sites/cake/app/tmp/cache/persistent/ is not writable [CORE/cake/libs/cache/file.php, line 267]
Warning (512): /Users/myname/Sites/cake/app/tmp/cache/models/ is not writable [CORE/cake/libs/cache/file.php, line 267]
Notice (1024): Please change the value of 'Security.salt' in app/config/core.php to a salt value specific to your application [CORE/cake/libs/debugger.php, line 694]
Notice (1024): Please change the value of 'Security.cipherSeed' in app/config/core.php to a numeric (digits only) seed value specific to your application [CORE/cake/libs/debugger.php, line 698]
という3つの Warning と2つの Notice が出ますが、とりあえず動いてるってことでOKでしょう。

一つ一つ対応していきます。

/app/tmp/cache を書き込み可能にします。
ついでに /app/tmp も書き込み可能にするので、/appに移動して、

chmod -R 0777 tmp
とします。 ブラウザをリロードします。

引き続き、/app/config/core.php を開いて、

 Configure::write('Security.salt', 'DYhG93b0qyJfIxfs2guVoUubWwvniR2G0FgaC9mi');
 Configure::write('Security.cipherSeed', '76859309657453542496749683645');
の2つの部分の値を書き換えます。

これでOKのはずですが、もし、php が 5.3 で、しかも php.ini に default timezone の設定をしていなかったりすると、

Warning (2): strtotime() [function.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 [CORE/cake/libs/cache.php, line 597]
というような激しいエラーが出ますので、その場合は、 /app/config/core.php の、
 //date_default_timezone_set('UTC');
となっているところを、
 date_default_timezone_set('Asia/Tokyo');
としておきます。
できれば php.ini の方を設定することをおすすめします。

最後、ついでなので、以下の一行のコメントアウトを外しておきます。

 //Configure::write('Routing.prefixes', array('admin'));


ブログ アーカイブ

このブログを検索

Powered by Blogger.

ラベル

php (17) jQuery (13) OSX (10) MySQL (8) Javascript (7) Postgres (7) port (7) apache (6) Java (3) Smarty (2) html (2) pear (2) FCKEditor (1) XAMPP (1) css (1) git (1) perl (1) ruby (1)

Facebookバナー