cloud9にCakePHP3.3をインストールする
先日cloud9にPHP7をインストールしたので、CakePHP3を入れてみようと思う。
公式サイトのインストール手順通りに実施する
composerを使いCakePHP3をインストール
cloud9:~/workspace $ composer create-project --prefer-dist cakephp/app cake3 Installing cakephp/app (3.3.2) - Installing cakephp/app (3.3.2) Downloading: 100% Created project in cake3 Loading composer repositories with package information Updating dependencies (including require-dev) Your requirements could not be resolved to an installable set of packages. Problem 1 - cakephp/cakephp 3.3.4 requires ext-intl * -> the requested PHP extension intl is missing from your system. - cakephp/cakephp 3.3.3 requires ext-intl * -> the requested PHP extension intl is missing from your system. - cakephp/cakephp 3.3.2 requires ext-intl * -> the requested PHP extension intl is missing from your system. - cakephp/cakephp 3.3.1 requires ext-intl * -> the requested PHP extension intl is missing from your system. - cakephp/cakephp 3.3.0-beta3 requires ext-intl * -> the requested PHP extension intl is missing from your system. - cakephp/cakephp 3.3.0-beta2 requires ext-intl * -> the requested PHP extension intl is missing from your system. - cakephp/cakephp 3.3.0-beta requires ext-intl * -> the requested PHP extension intl is missing from your system. - cakephp/cakephp 3.3.0-RC1 requires ext-intl * -> the requested PHP extension intl is missing from your system. - cakephp/cakephp 3.3.0 requires ext-intl * -> the requested PHP extension intl is missing from your system. - Installation request for cakephp/cakephp 3.3.* -> satisfiable by cakephp/cakephp[3.3.0, 3.3.0-RC1, 3.3.0-beta, 3.3.0-beta2, 3.3.0-beta3, 3.3.1, 3.3.2, 3.3.3, 3.3.4]. To enable extensions, verify that they are enabled in those .ini files: - /etc/php/7.0/cli/php.ini - /etc/php/7.0/cli/conf.d/10-opcache.ini - /etc/php/7.0/cli/conf.d/10-pdo.ini - /etc/php/7.0/cli/conf.d/20-calendar.ini - /etc/php/7.0/cli/conf.d/20-ctype.ini - /etc/php/7.0/cli/conf.d/20-exif.ini - /etc/php/7.0/cli/conf.d/20-fileinfo.ini - /etc/php/7.0/cli/conf.d/20-ftp.ini - /etc/php/7.0/cli/conf.d/20-gettext.ini - /etc/php/7.0/cli/conf.d/20-iconv.ini - /etc/php/7.0/cli/conf.d/20-json.ini - /etc/php/7.0/cli/conf.d/20-phar.ini - /etc/php/7.0/cli/conf.d/20-posix.ini - /etc/php/7.0/cli/conf.d/20-readline.ini - /etc/php/7.0/cli/conf.d/20-shmop.ini - /etc/php/7.0/cli/conf.d/20-sockets.ini - /etc/php/7.0/cli/conf.d/20-sysvmsg.ini - /etc/php/7.0/cli/conf.d/20-sysvsem.ini - /etc/php/7.0/cli/conf.d/20-sysvshm.ini - /etc/php/7.0/cli/conf.d/20-tokenizer.ini You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
PHPのエクステンションが不足していると。。。
the requested PHP extension intl is missing from your system.
さっそくcloud9でのインストール手順を検索すると、「php7.0-intl」を入れれば良いらしい。
CakePHP3は「mbstring, mcrypt, intl が必要」との記載があったので、それらもインストールする必要がある。
※libmcrypt-devは先日インストール済み。
php7.0-intlのインストール
cloud9:~/workspace $ sudo apt-get install php7.0-intl Reading package lists... Done Building dependency tree Reading state information... Done The following NEW packages will be installed: php7.0-intl 0 upgraded, 1 newly installed, 0 to remove and 83 not upgraded. Need to get 124 kB of archives. After this operation, 560 kB of additional disk space will be used. Get:1 http://ppa.launchpad.net/ondrej/php/ubuntu/ trusty/main php7.0-intl amd64 7.0.11-1+deb.sury.org~trusty+1 [124 kB] Fetched 124 kB in 1s (67.9 kB/s) Selecting previously unselected package php7.0-intl. (Reading database ... 76123 files and directories currently installed.) Preparing to unpack .../php7.0-intl_7.0.11-1+deb.sury.org~trusty+1_amd64.deb ... Unpacking php7.0-intl (7.0.11-1+deb.sury.org~trusty+1) ... Processing triggers for libapache2-mod-php7.0 (7.0.11-1+deb.sury.org~trusty+1) ... Setting up php7.0-intl (7.0.11-1+deb.sury.org~trusty+1) ... Creating config file /etc/php/7.0/mods-available/intl.ini with new version Processing triggers for libapache2-mod-php7.0 (7.0.11-1+deb.sury.org~trusty+1) ...
php7.0-mbstringのインストール
cloud9:~/workspace $ sudo apt-get install php7.0-mbstring Reading package lists... Done Building dependency tree Reading state information... Done The following NEW packages will be installed: php7.0-mbstring 0 upgraded, 1 newly installed, 0 to remove and 83 not upgraded. Need to get 462 kB of archives. After this operation, 1542 kB of additional disk space will be used. Get:1 http://ppa.launchpad.net/ondrej/php/ubuntu/ trusty/main php7.0-mbstring amd64 7.0.11-1+deb.sury.org~trusty+1 [462 kB] Fetched 462 kB in 3s (127 kB/s) Selecting previously unselected package php7.0-mbstring. (Reading database ... 76132 files and directories currently installed.) Preparing to unpack .../php7.0-mbstring_7.0.11-1+deb.sury.org~trusty+1_amd64.deb ... Unpacking php7.0-mbstring (7.0.11-1+deb.sury.org~trusty+1) ... Processing triggers for libapache2-mod-php7.0 (7.0.11-1+deb.sury.org~trusty+1) ... Setting up php7.0-mbstring (7.0.11-1+deb.sury.org~trusty+1) ... Creating config file /etc/php/7.0/mods-available/mbstring.ini with new version Processing triggers for libapache2-mod-php7.0 (7.0.11-1+deb.sury.org~trusty+1) ...
再度、CakePHP3をcomposerでインストール
cloud9:~/workspace $ composer create-project --prefer-dist cakephp/app cake3 Installing cakephp/app (3.3.2) - Installing cakephp/app (3.3.2) Loading from cache Created project in cake3 Loading composer repositories with package information Updating dependencies (including require-dev) - Installing aura/installer-default (1.0.0) Downloading: 100% - Installing cakephp/plugin-installer (0.0.15) Downloading: 100% - Installing psr/log (1.0.0) Downloading: 100% - Installing cakephp/chronos (1.0.0) Downloading: 100% - Installing mobiledetect/mobiledetectlib (2.8.22) Downloading: 100% - Installing psr/http-message (1.0.1) Downloading: 100% - Installing zendframework/zend-diactoros (1.3.6) Downloading: 100% - Installing aura/intl (1.1.1) Downloading: 100% - Installing cakephp/cakephp (3.3.4) Downloading: 100% - Installing symfony/yaml (v3.1.4) Downloading: 100% - Installing symfony/polyfill-mbstring (v1.2.0) Downloading: 100% - Installing symfony/console (v3.1.4) Downloading: 100% - Installing symfony/filesystem (v3.1.4) Downloading: 100% - Installing symfony/config (v3.1.4) Downloading: 100% - Installing robmorgan/phinx (v0.5.3) Downloading: 100% - Installing cakephp/migrations (1.6.3) Downloading: 100% - Installing jakub-onderka/php-console-color (0.1) Downloading: 100% - Installing jakub-onderka/php-console-highlighter (v0.3.2) Downloading: 100% - Installing dnoegel/php-xdg-base-dir (0.1) Downloading: 100% - Installing nikic/php-parser (v2.1.1) Downloading: 100% - Installing symfony/var-dumper (v3.1.4) Downloading: 100% - Installing psy/psysh (v0.7.2) Downloading: 100% - Installing jdorn/sql-formatter (v1.2.17) Downloading: 100% - Installing cakephp/debug_kit (3.3.3) Downloading: 100% - Installing cakephp/bake (1.2.8) Downloading: 100% cakephp/app suggests installing markstory/asset_compress (An asset compression plugin which provides file concatenation and a flexible filter system for preprocessing and minification.) cakephp/app suggests installing phpunit/phpunit (Allows automated tests to be run without system-wide install.) cakephp/app suggests installing cakephp/cakephp-codesniffer (Allows to check the code against the coding standards used in CakePHP.) symfony/console suggests installing symfony/event-dispatcher () symfony/console suggests installing symfony/process () symfony/var-dumper suggests installing ext-symfony_debug () psy/psysh suggests installing ext-pdo-sqlite (The doc command requires SQLite to work.) cakephp/debug_kit suggests installing ext-sqlite (DebugKit needs to store panel data in a database. SQLite is simple and easy to use.) Writing lock file Generating autoload files > Cake\Composer\Installer\PluginInstaller::postAutoloadDump > App\Console\Installer::postInstall Created `config/app.php` file Set Folder Permissions ? (Default to Y) [Y,n]? Y Permissions set on /home/ubuntu/workspace/cake3/tmp/cache Permissions set on /home/ubuntu/workspace/cake3/tmp/cache/models Permissions set on /home/ubuntu/workspace/cake3/tmp/cache/persistent Permissions set on /home/ubuntu/workspace/cake3/tmp/cache/views Permissions set on /home/ubuntu/workspace/cake3/tmp/sessions Permissions set on /home/ubuntu/workspace/cake3/tmp/tests Permissions set on /home/ubuntu/workspace/cake3/tmp Permissions set on /home/ubuntu/workspace/cake3/logs Updated Security.salt value in config/app.php
インストール成功。
指示通り、config/app.phpのSecurity.saltを書き換える
/** * Security and encryption configuration * * - salt - A random string used in security hashing methods. * The salt value is also used as the encryption key. * You should treat it as extremely sensitive data. */ 'Security' => [ 'salt' => env('SECURITY_SALT', '86ecfe4e24262288992769ef8d8314aef9e40314fcadf91223ca2c7afbf3285a'), ],
さっそくcloud9へブラウザからアクセスしてみる。
cake3ディレクトリにインストールしたので、
URLはこんな感じになる。
http://XXX.c9users.io/cake3/
この画面にエラーなりワーニングがでれば問題あり。
DBの接続設定がまだ終わっていないのでワーニング。
他は問題なし。
PHPのバージョンもPHP7で認識されている。
cloud9へのCakePHP3のインストールはこのような手順でできる。