cakephp3をmacにインストールする際に行ったことを備忘録としてまとめた記事です。
参考にしたサイト様
発生した問題
- composerを用いてcakephpをインストールする際に以下のエラーが発生しました
- エラーの主原因は extension-intlがないことらしい
-
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.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].
解決策その1(☓)
cd /usr/lib/php
-
sudo php install-pear-nozlib.phar
- Capitanの場合、SIPを無効にする必要あり
brew install icu4c
-
sudo pecl install intl
ICU libraries and headers path is: /usr/local/opt/icu4c/
sudo brew install autoconf
sudo brew install automake
-
$vi /etc/php.ini
- 以下の行を付け加えた
-
extension=/usr/lib/php/extensions/no-debug-non-zts-20121212/intl.so
しかし、エラ―は直らず。
解決策その2(◯)
- php.ini は上記のまま
curl -s https://getcomposer.org/installer | /Applications/XAMPP/bin/php
/Applications/XAMPP/bin/php composer.phar create-project --prefer-dist cakephp/app bookmarker
インストールできました。
疑問
- 解決策1と2の違い
-
usr/bin/php
を使うか/Applications/XAMPP/bin/php
を使うか- なぜ
/Applications/XAMPP/bin/php
を使用するとうまくいくのか
- なぜ
-
なぜ解決策2でインストールができたのかが不明ですが、ひとまず解決です。