end0tknr's kipple - web写経開発

太宰府天満宮の狛犬って、妙にカワイイ

php 5.6 + openssl 1.0.2 + cakephp 3.2 のインストール

参考url

http://book.cakephp.org/3.0/ja/installation.html http://book.cakephp.org/3.0/en/installation.html

openssl 1.0.2

opensslが、shared libraries 付でなかった為、再make.

$ wget https://www.openssl.org/source/openssl-1.0.2g.tar.gz
$ tar -zxvf openssl-1.0.2g.tar.gz
$ cd openssl-1.0.2g
$ less INSTALL
$ ./config --prefix=/usr/local/openssl_1.0.2 shared
$ make
$ make test
$ su
# make install

ICU - International Components for Unicode

cakephpが必要とする phpのintlモジュールが、更に icuを必要する為

$ wget http://download.icu-project.org/files/icu4c/57.1/icu4c-57_1-src.tgz
$ tar -zxvf icu4c-57_1-src.tgz
$ cd icu/source
$ ./configure
$ make
$ make check
$ su
# make install

php 5.6.21

http://end0tknr.hateblo.jp/entry/20140501/1398939088

  • ※ configureのoptionは、以前行った php 5.5.11に対して、cakephp3が必要とする " --enable-intl "を追加します
  • ※ make test で、14個の Tests failedがありましたが、無視して make installしました
$ wget http://jp2.php.net/get/php-5.6.21.tar.gz/from/this/mirror
$ mv mirror php-5.6.21.tar.gz
$ tar -zxvf php-5.6.21.tar.gz
$ cd php-5.6.21.tar.gz
$ ./configure \
  --with-apxs2=/home/endo/local/apache22/bin/apxs \
  --enable-mbstring \
  --with-mysql=/usr/local/mysql \
  --with-mysqli=/usr/local/mysql/bin/mysql_config \
  --with-pdo-mysql=/usr/local/mysql \
  --with-openssl=/usr/local/openssl_1.0.2 \
  --enable-intl
$ make
$ make test
  :
=====================================================================
TEST RESULT SUMMARY
---------------------------------------------------------------------
Exts skipped    :   46
Exts tested     :   33
---------------------------------------------------------------------

Number of tests : 13815             10408
Tests skipped   : 3407 ( 24.7%) --------
Tests warned    :    9 (  0.1%) (  0.1%)
Tests failed    :   14 (  0.1%) (  0.1%)
Expected fail   :   39 (  0.3%) (  0.4%)
Tests passed    : 10346 ( 74.9%) ( 99.4%)
---------------------------------------------------------------------
Time taken      :  597 seconds
=====================================================================
  :
=====================================================================
FAILED TEST SUMMARY
---------------------------------------------------------------------
Bug #62046  mysqli@mysqlnd can't iterate over stored sets after call to mysqli_stmt_reset() [ext/mysqli/tests/bug62046.phpt]
Bug #66043 (Segfault calling bind_param() on mysqli) [ext/mysqli/tests/bug66043.phpt]
API vs. SQL LAST_INSERT_ID() [ext/mysqli/tests/mysqli_last_insert_id.phpt]
Persistent connections and mysqli.max_links [ext/mysqli/tests/mysqli_pconn_max_links.phpt]
mysqli iterators [ext/mysqli/tests/mysqli_query_iterators.phpt]
mysqli_release_savepoint() [ext/mysqli/tests/mysqli_release_savepoint.phpt]
mysqli_store_result() [ext/mysqli/tests/mysqli_store_result_buffered_c.phpt]
Bug #65538: SSL context "cafile" disallows URL stream wrappers [ext/openssl/tests/bug65538_002.phpt]
Bug #70389 (PDO constructor changes unrelated variables) [ext/pdo_mysql/tests/bug70389.phpt]
Bug #61411 (PDO Segfaults with PERSISTENT == TRUE && EMULATE_PREPARES == FALSE) [ext/pdo_mysql/tests/bug_61411.phpt]
MySQL PDO->__construct(), PDO::MYSQL_ATTR_MAX_BUFFER_SIZE [ext/pdo_mysql/tests/pdo_mysql_attr_max_buffer_size.phpt]
PDO::ATTR_ORACLE_NULLS [ext/pdo_mysql/tests/pdo_mysql_attr_oracle_nulls.phpt]
MySQL PDO->exec(), affected rows [ext/pdo_mysql/tests/pdo_mysql_exec.phpt]
file_get_contents() test using offset parameter out of range [ext/standard/tests/file/file_get_contents_error001.phpt]
=====================================================================
  :
$ su
# make install
# cp php.ini-development /usr/local/lib/php.ini

パッケージ管理 Composer

phpではdefaultのpearがありますが、最近では、Composer もあるそうです。 cakephp3のdocumentによれば、Composer が cakephp3を管理するそうです。

$ cd /home/endo/dev
$ curl -s https://getcomposer.org/installer | /usr/local/bin/php
All settings correct for using Composer
Downloading 1.0.3...

Composer successfully installed to: /home/endo/dev/composer.phar
Use it: php composer.phar

cakephp3 プロジェクト作成

$ cd /home/endo/dev
$ /usr/local/bin/php composer.phar create-project --prefer-dist cakephp/app test_cake

ただし、intlモジュールのないphpで、cakephp3 のプロジェクトを作成しようとすると、次のようなエラーが表示されます

$ /usr/local/bin/php composer.phar create-project --prefer-dist cakephp/app my_app_name
Installing cakephp/app (3.2.6)
  - Installing cakephp/app (3.2.6)
    Downloading: 100%         
Created project in my_app_name
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.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.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.2, 3.2.3, 3.2.4, 3.2.5, 3.2.6, 3.2.7, 3.2.8].
  To enable extensions, verify that they are enabled in those .ini files:
    - /usr/local/lib/php.ini
  You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
     :
$ 

cakephp3 の起動

$ cd /home/endo/dev
$ test_cake/bin/cake server -H cent6.a5.jp -p 5673

ACCESS TO http://cent6.a5.jp:5673

この後、ルーティングから読み進めるのであれば、$APP_ROOT/config/routes.php を参照