1
0

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 3 years have passed since last update.

CakePHP3.9をMacにインストールする(MAMP使用)

Last updated at Posted at 2020-10-01

環境

バージョンは下記

  • OS:MacOS Catalina 10.15.4

  • PHP:7.3.22

  • Composer:1.10.13

今回はデータベースについては触れません

データベース入れました→ CakePHP3.9にMySQLを接続する(Homebrew使用)

MAMPのダウンロード

CakePHPのアプリの作成

$ cd Applications
$ ls
$ cd MAMP

↑MAMPが複数ある場合は名前が違うことがあるので注意

  • htdocsに入る(この中にCakePHPアプリをおきたい)
$ cd htdocs
  • CakePHPアプリの作成
$ php composer.phar create-project --prefer-dist cakephp/app:^3.8 app_name

または

$ composer self-update && composer create-project --prefer-dist cakephp/app:^3.8 app_name

でCakePHPのアプリが作られる(app_nameのところには任意のアプリ名を入れる)

Updating to version 1.10.13 (stable channel).
   Downloading (100%)         
Use composer self-update --rollback to return to version 1.10.5
Creating a "cakephp/app:^3.8" project at "./app_name"
Installing cakephp/app (3.9.0)
.
.
. 省略
.
.
> App\Console\Installer::postInstall
Created `config/app_local.php` file
Created `/Applications/MAMP/htdocs/app_name/tmp/cache/views` directory
Set Folder Permissions ? (Default to Y) [Y,n]?

↑ファイルの権限を設定していいかcomposerに聞かれるけどYと答えてEnter。

  • アプリが作成されているか確認してアプリフォルダに入る
$ ls 
app_name
$ cd app_name
  • 起動!!!
$ bin/cake server
Welcome to CakePHP v3.9.2 Console
---------------------------------------------------------------
App : src
Path: /Applications/MAMP/htdocs/app_name/src/
DocumentRoot: /Applications/MAMP/htdocs/app_name/webroot
Ini Path:
---------------------------------------------------------------
built-in server is running in http://localhost:8765/
You can exit with `CTRL-C`
  • 上記のような表示が出たら成功

  • ブラウザで http://localhost:8765/ にアクセスしてみる

スクリーンショット 2020-10-02 0.29.04.png

ここまで。

1
0
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?