5
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

CakePHP dev-3 + Windows7 + IIS + MySQLの環境構築

Posted at

前提条件

  • composerインストール済み(composerパス設定済み)
  • php5.4.19以上インストール済み
  • MySQLインストール済み

CakePHP dev3.0のインストール

GitHubのリポジトリにはcomposerからインストールできると書いてある(と思う)がうまくいかないので、app skeletonからgit cloneする方法でインストールする。

cmd
rem composer自身のアップデート
composer self-update

rem cakephp/appパッケージから[app_name]のプロジェクトを作成
composer create-project -s dev cakephp/app [app_name]

rem [app_name]に移動
cd [app_name]/vendor/cakephp/cakephp

rem cakephpリポジトリをクローン
git clone git://github.com/cakephp/cakephp.git

rem cakephp 3.0ブランチをチェックアウト
git checkout -t -b 3.0 origin/3.0

ディレクトリ構成

[app_name]
  |
  |-App
  | ...
  |-Plugin
  |-Test
  |-tmp
  |-vendor
  |   |-bin
  |   |  |...
  |   |-cakephp
  |   |  |-cakephp
  |   |  |    |-src  //Cake Core
  |   |  |    |-tests
  |   |  |...
  |   |-composer
  |   |  |...
  |   |-d11wtq
  |   |  |...
  |   |-autoload.php
  |   |-empty
  |-webroot
      |...

web.configの設定

URL Rewrites on IIS7 (Windows hosts)をそのままコピーして[app_name]直下に配置

[app_name]/index.phpの追加

下記を追記したindex.phpを[app_name]直下に配置

[app_name]/index.php
require 'webroot' . DIRECTORY_SEPARATOR . 'index.php';

app.phpの設定(データベース設定)

'Datasources' => [
	'default' => [
		'className' => 'Cake\Database\Connection',
		'driver' => 'Cake\Database\Driver\Mysql',
		'persistent' => false,
		'host' => 'localhost',
		'login' => 'my_app',
		'password' => 'secret',
		'database' => 'my_app',
		'prefix' => false,
		'encoding' => 'utf8',
		'timezone' => 'UTC'
	],

	/**
	 * The test connection is used during the test suite.
	 */
	// 'test' => [
	// 	'className' => 'Cake\Database\Connection',
	// 	'driver' => 'Cake\Database\Driver\Mysql',
	// 	'persistent' => false,
	// 	'host' => 'localhost',
	// 	'login' => 'my_app',
	// 	'password' => 'secret',
	// 	'database' => 'my_app',
	// 	'prefix' => false,
	// 	'encoding' => 'utf8',
	// 	'timezone' => 'UTC'
	// ],
	],
...

プラグインの追加

推奨プラグインであるDebugKitとlocalizedをcomposer.jsに追加

composer.json
...
"require": {
...
    "cakephp/debug_kit": "2.2.*",
    "cakephp/localized": "2.1.*"
}
...

composer実行

cmd
cd [app_name]
composer update

確認

http://localhost/[app_name]にアクセスして、下記画面がでればOK!

SnapCrab_NoName_2014-4-14_16-40-6_No-00.jpg

5
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?