temporary:cakephp
● ダウンロード・解凍
CakePHP 本体
# wget --no-check-certificate https://github.com/cakephp/cakephp/zipball/1.3.6
# unzip cakephp-cakephp-1.3.6-0-g4c33375.zip
Datasources プラグイン
# wget --no-check-certificate https://github.com/cakephp/datasources/tarball/0.2
# tar zxvf cakephp-datasources-0.2-0-geba5382.tar.gz
● cakephp の設置
参考:
http://www.cafechantant.com/blog/2007/09/17/%E3%81%95%E3%81%8F%E3%82%89%E3%81%A7-cakephp/
http://book.cakephp.org/ja/view/35/%E5%BF%9C%E7%94%A8%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB
http://mori.moripower.jp/eqwip/cakephp/370.html
■ DL直後の構成
/
├ app
│ ├ xxxxx
│ └ webroot
├ cake
├ plugins
├ vendors
├ .gitignore
├ .htaccess
├ index.php
└ README
■ 設置例
/
├ home
│ └ clown
│ └ cakeapp
│ └ dbo_adodb.php
│ └ app
├ usr
│ └ lib
│ └ cake
├ var
│ └ www
│ └ vhosts
│ └ www6004u.sakura.ne.jp
│ └ cake(webroot)
│ └ index.php
■ プラグインの統合
# cp -r cakephp-datasources-54d46ac/models/datasources/dbo/* cakephp-cakephp-f6748d4/cake/libs/model/datasources/dbo/
■ コアライブラリ
# mv cakephp-cakephp-f6748d4/cake/ /usr/lib/cake/
■ アプリ
# mkdir -p /home/clown/cakeapp/
# mv cakephp-cakephp-f6748d4/app/ /home/clown/cakeapp/app/
■ ドキュメントルート
# mv /home/clown/cakeapp/app/webroot/ /var/www/vhosts/www6004u.sakura.ne.jp/cake/
■ パスの設定
# vi /var/www/vhosts/www6004u.sakura.ne.jp/cake/index.php
38行目付近
//define('ROOT', dirname(dirname(dirname(__FILE__))));
define('ROOT', DS.'home'.DS.'clown'.DS.'cakeapp');
47行目付近
//define('APP_DIR', basename(dirname(dirname(__FILE__))));
define('APP_DIR', 'app');
55行目付近
//define('CAKE_CORE_INCLUDE_PATH', ROOT);
define('CAKE_CORE_INCLUDE_PATH', DS.'usr'.DS.'lib');
# chmod -R 707 /home/clown/cakeapp/app/tmp/
● セキュリティ設定
# vi /var/www/vhosts/www6004u.sakura.ne.jp/cake/app/config/core.php
// Configure::write('Security.salt', 'DYhG93b0qyJfIxfs2guVoUubWwvniR2G0FgaC9mi');
Configure::write('Security.salt', 'ijlk409vajslk42kb954jagobfb44gagayajgoia');
// Configure::write('Security.cipherSeed', '76859309657453542496749683645');
Configure::write('Security.cipherSeed', '51435636865003542876257623947');
● データベース設定ファイル編集
# cp /var/www/vhosts/www6004u.sakura.ne.jp/cake/app/config/database.php.default /var/www/vhosts/www6004u.sakura.ne.jp/cake/app/config/database.php
# vi /var/www/vhosts/www6004u.sakura.ne.jp/cake/app/config/database.php
class DATABASE_CONFIG {
var $default = array(
'driver' => 'sqlite3',
'database' => '/var/www/vhosts/www6004u.sakura.ne.jp/db/fcb.db',
);
}
● bake
# cd /var/www/vhosts/www6004u.sakura.ne.jp/cake/
# cake/console/cake bake blog
# cd /home/clown/
# /usr/lib/cake/console/cake bake blog
# /usr/lib/cake/console/cake -app /home/clown/blog bake blog
*****************************************************************************************
Welcome to CakePHP v1.3.6 Console
---------------------------------------------------------------
App : Post
Path: /home/clown/Post
---------------------------------------------------------------
Interactive Bake Shell
---------------------------------------------------------------
[D]atabase Configuration
[M]odel
[V]iew
[C]ontroller
[P]roject
[F]ixture
[T]est case
[Q]uit
What would you like to Bake? (D/M/V/C/P/F/T/Q)
> m
---------------------------------------------------------------
Bake Model
Path: /home/clown/Post/models/
---------------------------------------------------------------
Possible Models based on your current database:
1. Post
2. SqliteSequence
Enter a number from the list above,
type in the name of another model, or 'q' to exit
[q] > 1
Would you like to supply validation criteria
for the fields in your model? (y/n)
[y] >
Field: id
Type: integer
---------------------------------------------------------------
Please select one of the following validation options:
---------------------------------------------------------------
1 - alphanumeric
2 - between
3 - blank
4 - boolean
5 - cc
6 - comparison
7 - custom
8 - date
9 - decimal
10 - email
11 - equalto
12 - extension
13 - inlist
14 - ip
15 - maxlength
16 - minlength
17 - money
18 - multiple
19 - notempty
20 - numeric
21 - phone
22 - postal
23 - range
24 - ssn
25 - time
26 - url
27 - userdefined
28 - Do not do any validation on this field.
... or enter in a valid regex validation string.
[28] >
Field: title
Type: text
---------------------------------------------------------------
Please select one of the following validation options:
---------------------------------------------------------------
1 - alphanumeric
2 - between
3 - blank
4 - boolean
5 - cc
6 - comparison
7 - custom
8 - date
9 - decimal
10 - email
11 - equalto
12 - extension
13 - inlist
14 - ip
15 - maxlength
16 - minlength
17 - money
18 - multiple
19 - notempty
20 - numeric
21 - phone
22 - postal
23 - range
24 - ssn
25 - time
26 - url
27 - userdefined
28 - Do not do any validation on this field.
... or enter in a valid regex validation string.
[28] > 19
Would you like to add another validation rule? (y/n)
[n] > y
Field: title
Type: text
---------------------------------------------------------------
Please select one of the following validation options:
---------------------------------------------------------------
1 - alphanumeric
2 - between
3 - blank
4 - boolean
5 - cc
6 - comparison
7 - custom
8 - date
9 - decimal
10 - email
11 - equalto
12 - extension
13 - inlist
14 - ip
15 - maxlength
16 - minlength
17 - money
18 - multiple
19 - notempty
20 - numeric
21 - phone
22 - postal
23 - range
24 - ssn
25 - time
26 - url
27 - userdefined
28 - Do not do any validation on this field.
... or enter in a valid regex validation string.
[28] > 15
Would you like to add another validation rule? (y/n)
[n] >
Field: body
Type: text
---------------------------------------------------------------
Please select one of the following validation options:
---------------------------------------------------------------
1 - alphanumeric
2 - between
3 - blank
4 - boolean
5 - cc
6 - comparison
7 - custom
8 - date
9 - decimal
10 - email
11 - equalto
12 - extension
13 - inlist
14 - ip
15 - maxlength
16 - minlength
17 - money
18 - multiple
19 - notempty
20 - numeric
21 - phone
22 - postal
23 - range
24 - ssn
25 - time
26 - url
27 - userdefined
28 - Do not do any validation on this field.
... or enter in a valid regex validation string.
[28] > 19
Would you like to add another validation rule? (y/n)
[n] >
Field: created
Type: datetime
---------------------------------------------------------------
Please select one of the following validation options:
---------------------------------------------------------------
1 - alphanumeric
2 - between
3 - blank
4 - boolean
5 - cc
6 - comparison
7 - custom
8 - date
9 - decimal
10 - email
11 - equalto
12 - extension
13 - inlist
14 - ip
15 - maxlength
16 - minlength
17 - money
18 - multiple
19 - notempty
20 - numeric
21 - phone
22 - postal
23 - range
24 - ssn
25 - time
26 - url
27 - userdefined
28 - Do not do any validation on this field.
... or enter in a valid regex validation string.
[28] >
Field: modified
Type: datetime
---------------------------------------------------------------
Please select one of the following validation options:
---------------------------------------------------------------
1 - alphanumeric
2 - between
3 - blank
4 - boolean
5 - cc
6 - comparison
7 - custom
8 - date
9 - decimal
10 - email
11 - equalto
12 - extension
13 - inlist
14 - ip
15 - maxlength
16 - minlength
17 - money
18 - multiple
19 - notempty
20 - numeric
21 - phone
22 - postal
23 - range
24 - ssn
25 - time
26 - url
27 - userdefined
28 - Do not do any validation on this field.
... or enter in a valid regex validation string.
[28] >
Would you like to define model associations
(hasMany, hasOne, belongsTo, etc.)? (y/n)
[y] > n
---------------------------------------------------------------
The following Model will be created:
---------------------------------------------------------------
Name: Post
DB Table: "posts"
Validation: Array
(
[title] => Array
(
[notempty] => notempty
[maxlength] => maxlength
)
[body] => Array
(
[notempty] => notempty
)
)
---------------------------------------------------------------
Look okay? (y/n)
[y] >
Baking model class for Post...
Creating file /home/clown/Post/models/post.php
Wrote `/home/clown/Post/models/post.php`
SimpleTest is not installed. Do you want to bake unit test files anyway? (y/n)
[y] > n
---------------------------------------------------------------
Interactive Bake Shell
---------------------------------------------------------------
[D]atabase Configuration
[M]odel
[V]iew
[C]ontroller
[P]roject
[F]ixture
[T]est case
[Q]uit
What would you like to Bake? (D/M/V/C/P/F/T/Q)
> c
---------------------------------------------------------------
Bake Controller
Path: /home/clown/Post/controllers/
---------------------------------------------------------------
Possible Controllers based on your current database:
1. Posts
2. SqliteSequences
Enter a number from the list above,
type in the name of another controller, or 'q' to exit
[q] > 1
---------------------------------------------------------------
Baking PostsController
---------------------------------------------------------------
Would you like to build your controller interactively? (y/n)
[y] >
Would you like to use dynamic scaffolding? (y/n)
[n] >
Would you like to create some basic class methods
(index(), add(), view(), edit())? (y/n)
[n] > y
Would you like to create the basic class methods for admin routing? (y/n)
[n] >
Would you like this controller to use other helpers
besides HtmlHelper and FormHelper? (y/n)
[n] >
Would you like this controller to use any components? (y/n)
[n] >
Would you like to use Session flash messages? (y/n)
[y] > n
---------------------------------------------------------------
The following controller will be created:
---------------------------------------------------------------
Controller Name:
Posts
---------------------------------------------------------------
Look okay? (y/n)
[y] >
Creating file /home/clown/Post/controllers/posts_controller.php
Wrote `/home/clown/Post/controllers/posts_controller.php`
SimpleTest is not installed. Do you want to bake unit test files anyway? (y/n)
[y] > n
---------------------------------------------------------------
Interactive Bake Shell
---------------------------------------------------------------
[D]atabase Configuration
[M]odel
[V]iew
[C]ontroller
[P]roject
[F]ixture
[T]est case
[Q]uit
What would you like to Bake? (D/M/V/C/P/F/T/Q)
> v
---------------------------------------------------------------
Bake View
Path: /home/clown/Post/views/
---------------------------------------------------------------
Possible Controllers based on your current database:
1. Posts
2. SqliteSequences
Enter a number from the list above,
type in the name of another controller, or 'q' to exit
[q] > 1
Would you like bake to build your views interactively?
Warning: Choosing no will overwrite Posts views if it exist. (y/n)
[n] >
Creating file /home/clown/Post/views/posts/index.ctp
Wrote `/home/clown/Post/views/posts/index.ctp`
Creating file /home/clown/Post/views/posts/view.ctp
Wrote `/home/clown/Post/views/posts/view.ctp`
Creating file /home/clown/Post/views/posts/add.ctp
Wrote `/home/clown/Post/views/posts/add.ctp`
Creating file /home/clown/Post/views/posts/edit.ctp
Wrote `/home/clown/Post/views/posts/edit.ctp`
---------------------------------------------------------------
View Scaffolding Complete.
---------------------------------------------------------------
Interactive Bake Shell
---------------------------------------------------------------
[D]atabase Configuration
[M]odel
[V]iew
[C]ontroller
[P]roject
[F]ixture
[T]est case
[Q]uit
What would you like to Bake? (D/M/V/C/P/F/T/Q)
> q
temporary/cakephp.txt · 最終更新: 2025/02/16 13:53 by 127.0.0.1
