LoginSignup
3
2

More than 5 years have passed since last update.

HomebrewでCakePHP環境構築〜インストール編

Last updated at Posted at 2018-02-03

intlをインストール

CakePHPをインストールするためには、まずintlというものが必要らしい。

PHPのバージョンを確認し、brew searchで該当するパッケージを確認後、インストールする。

$ php -v
$ brew search intl
$ brew install homebrew/php/php71-intl

今回composer.jsonの編集は行わなかった気がするが・・・どうやらパッケージの依存情報を定義するファイルらしい。

ComposerでCakePHPをインストール

アプリケーションを作成したい場所(ディレクトリ)へ移動し、実際に作成する。今回はtestcakeという名前にする。

途中でSet Folder Permissions ? (Default to Y) [Y,n]?と聞かれるので、Yを入力して進める。

$ composer self-update && composer create-project --prefer-dist cakephp/app testcake

You are already using composer version 1.6.2 (stable channel).
Installing cakephp/app (3.5.1)
  - Installing cakephp/app (3.5.1): Loading from cache
Created project in testcake
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 47 installs, 0 updates, 0 removals
以下略

作成したアプリケーションのディレクトリへ移動し、PHPの組み込みウェブサーバーを起動する。

$ cd testcake
$ bin/cake server 

Welcome to CakePHP v3.5.11 Console
---------------------------------------------------------------
App : src
Path: /Users/yuki/workspace/testcake/src/
DocumentRoot: /Users/yuki/workspace/testcake/webroot
---------------------------------------------------------------
built-in server is running in http://localhost:8765/
You can exit with `CTRL-C`

ブラウザを開いてhttp://localhost:8765/にアクセスし、CakePHPの画面が開けば作業完了。もしくは別ターミナルでcurlコマンドを使用して確認する。

$ curl -I  http://localhost:8765/

ちなみにCakePHPでは8765番ポートが使用されている。こちらも別ターミナルを開き、lsofコマンドで確認可能。

$ lsof -i:8765

終了はCtrl+Cで。
とりあえず、起動はできた。

3
2
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
3
2