cakephp3でDebugKitが出てこない

Ubuntu14.04にcakephp3をインストールして、Debugkitを使おうとしたら、最初っから入ってる様子
だけど、出てこない

マニュアル見るとsqlite3を使っている..ログを見ると

2016-07-01 10:25:19 Warning: DebugKit not enabled. You need to either install pdo_sqlite, or define the "debug_kit" connection name.

phpがsqlite3を扱えない様子
インストールします

$ sudo apt-get install php-sqlite3

これで右下にケーキのアイコンが出てきて、DebugKitが使えるようになりました

cakephp 3を試してみる

php 7入のUbuntuで、cakephp 3を試してみました
Quick Start Guide

php のバージョンをチェック

$ php -v
PHP 7.0.7-4+deb.sury.org~trusty+1 (cli) ( NTS )

さっそくいれてみる

$ composer create-project –prefer-dist cakephp/app bookmarker

エラー..

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - cakephp/cakephp 3.2.9 requires ext-intl * -> the requested PHP extension intl is missing from your system.
    - cakephp/cakephp 3.2.8 requires ext-intl * -> the requested PHP extension intl is missing from your system.
    - cakephp/cakephp 3.2.7 requires ext-intl * -> the requested PHP extension intl is missing from your system.
    - cakephp/cakephp 3.2.6 requires ext-intl * -> the requested PHP extension intl is missing from your system.
    - cakephp/cakephp 3.2.5 requires ext-intl * -> the requested PHP extension intl is missing from your system.
    - cakephp/cakephp 3.2.4 requires ext-intl * -> the requested PHP extension intl is missing from your system.
    - cakephp/cakephp 3.2.3 requires ext-intl * -> the requested PHP extension intl is missing from your system.
    - cakephp/cakephp 3.2.2 requires ext-intl * -> the requested PHP extension intl is missing from your system.
    - cakephp/cakephp 3.2.11 requires ext-intl * -> the requested PHP extension intl is missing from your system.
    - cakephp/cakephp 3.2.10 requires ext-intl * -> the requested PHP extension intl is missing from your system.
    - cakephp/cakephp 3.2.1 requires ext-intl * -> the requested PHP extension intl is missing from your system.
    - cakephp/cakephp 3.2.0 requires ext-intl * -> the requested PHP extension intl is missing from your system.
    - Installation request for cakephp/cakephp ~3.2 -> satisfiable by cakephp/cakephp[3.2.0, 3.2.1, 3.2.10, 3.2.11, 3.2.2, 3.2.3, 3.2.4, 3.2.5, 3.2.6, 3.2.7, 3.2.8, 3.2.9].

  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-apcu.ini
    - /etc/php/7.0/cli/conf.d/20-apcu_bc.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-newrelic.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
    - /etc/php/7.0/cli/conf.d/20-xdebug.ini
  You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

PHP extension intl がないようなので入れます

$ sudo apt-get update
$ sudo apt-get php7.0-intl

念の為もう一度いれておきます

$ rm -rf bookmarker/
$ composer create-project –prefer-dist cakephp/app bookmarker

最後のほうのログがこんな感じ

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/user/ws/cakephp3/bookmarker/tmp/cache
Permissions set on /home/user/ws/cakephp3/bookmarker/tmp/cache/models
Permissions set on /home/user/ws/cakephp3/bookmarker/tmp/cache/persistent
Permissions set on /home/user/ws/cakephp3/bookmarker/tmp/cache/views
Permissions set on /home/user/ws/cakephp3/bookmarker/tmp/sessions
Permissions set on /home/user/ws/cakephp3/bookmarker/tmp/tests
Permissions set on /home/user/ws/cakephp3/bookmarker/tmp
Permissions set on /home/user/ws/cakephp3/bookmarker/logs
Updated Security.salt value in config/app.php

これでインストールできました
試しに起動

$ bin/cake server -H sample.com -p port

sample.com と port はご自由に
指定しない場合
localhost:8765で立ち上がるようです

起動した画面
https://gyazo.com/86a9ea1a19572c0b82068cd6720dad74

mysqlとつなぎます

ログイン

$ mysql -u user -ppassword

userとpasswordはご自身のもので

データベース作成
mysql> create database cake_bookmarks character set utf8;

データベース指定して
mysql> connect cake_bookmarks;

Quick Start Guide
のsqlを流します

テーブルまでできあがり

cakephpにデータベースの設定を書きます

$ vim config/app.php

で Datasources のところの設定を書き換えます
これでつながりました

ここまででベースができあがり

ApacheでInvalid command ‘Header’のエラー

Ubuntu 14.04 で Apache + WordPress を動かそうとしたらエラーが

$ tail /var/log/apache2/error.log

Invalid command 'Header', perhaps misspelled or defined by a module not included in the server configuration

Headers moduleが無効のようなので、

$ sudo a2enmod headers

これで有効になったので、Apache再起動

$ sudo service apache2 restart

これでエラーが取れました

Cakephpで不可算名詞をクラスにするときの命名規則

Cakephpではクラスは名詞の複数形で、モデルは単数形とかルールがあります
数えられない名詞は..ってときは

http://inflector.cakephp.org/

ここでためせば、教えてくれます