Skip to content

Instantly share code, notes, and snippets.

@ikuwow
Created May 2, 2015 04:06
Show Gist options
  • Save ikuwow/eb8c0f4e79cd292f1a5e to your computer and use it in GitHub Desktop.
Save ikuwow/eb8c0f4e79cd292f1a5e to your computer and use it in GitHub Desktop.
CakePHP2をComposerでサクッとセットアップする ref: http://qiita.com/ikuwow/items/748613ba234415cc7b0b
/vendors
/plugins
/app/tmp/*
/app/Config/core.php
/app/Config/database.php
CakePlugin::loadAll();
{
"name": "example-app",
"repositories": [
{
"type": "pear",
"url": "http://pear.cakephp.org"
}
],
"require": {
"cakephp/cakephp": ">=2.6.4,<3.0.0"
},
"require-dev": {
"phpunit/phpunit": "3.7.37",
"cakephp/debug_kit" : ">=2.2.4,<3.0.0"
},
"config": {
"vendor-dir": "vendors/"
},
"extra": {
"installer-paths": {
"./plugins/{$name}/": [
"cakephp/debug_kit"
]
}
}
}
$ mkdir cakephpapp/ # アプリのディレクトリ作成
$ vendors/bin/cake bake project app
Welcome to CakePHP v2.6.4 Console
---------------------------------------------------------------
App : testcakephp2
Path: /Users/degawaikuo/workspace/testcakephp2/
---------------------------------------------------------------
Skel Directory: /Users/degawaikuo/workspace/testcakephp2/vendors/cakephp/cakephp/lib/Cake/Console/Templates/skel
Will be copied to: /Users/degawaikuo/workspace/testcakephp2/app
---------------------------------------------------------------
Look okay? (y/n/q)
[y] > y
---------------------------------------------------------------
Created: app in /Users/degawaikuo/workspace/testcakephp2/app
---------------------------------------------------------------
* Random hash key created for 'Security.salt'
* Random seed created for 'Security.cipherSeed'
* Cache prefix set
* app/Console/cake.php path set.
CakePHP is not on your `include_path`, CAKE_CORE_INCLUDE_PATH will be hard coded.
You can fix this by adding CakePHP to your `include_path`.
* CAKE_CORE_INCLUDE_PATH set to /Users/degawaikuo/workspace/testcakephp2/vendors/cakephp/cakephp/lib in webroot/index.php
* CAKE_CORE_INCLUDE_PATH set to /Users/degawaikuo/workspace/testcakephp2/vendors/cakephp/cakephp/lib in webroot/test.php
* Remember to check these values after moving to production server
Project baked successfully!
$ cd app/webroot
$ php -S localhost:8989
$ git init
$ git add .
$ git commit -m'initial commit'
// これを
// define('CAKE_CORE_INCLUDE_PATH', DS . 'Users' . DS . 'username'. DS . 'testcakephp2' . DS . 'vendors' . DS . 'cakephp' . DS . 'cakephp' . DS . 'lib');
// こうする
define('CAKE_CORE_INCLUDE_PATH', ROOT. DS . 'vendors' . DS . 'cakephp' . DS . 'cakephp' . DS . 'lib');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment