KAEDE Hack blog

JavaScript 中心に ライブラリなどの使い方を解説する技術ブログ。

cakePHP, intl のERRと解決

installation

php composer.phar create-project --prefer-dist cakephp/app cms でスケルトンを作成しようとした macOS: 10.14.3 PHP 7.1.23 (cli) in /usr/bin/php/

Err

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

Problem 1 - cakephp/cakephp 3.7.6 requires ext-intl * -> the requested PHP extension intl is missing from your system.

と出てしまい - Installation request for cakephp/cakephp 3.7. * cakePHPのinstallができない?intlが必要?になってしまった

yum

(https://qiita.com/machio77777/items/be29ca83992976afdcec) [CakePHP3でintl導入時につまずいた事]

の記事の通りにPHP intlを有効にしようと思ったが、 yum list | grep intl まず yum コマンドが見つからない。 brewを使った。

homebrew reinstall

次に (https://qiita.com/machio77777/items/ffed4c214ad6ea493cec)

の記事を見て とりあえずhomebrewからのphp intlのinstallをしてみた。

しかし

Error: No available formula with the name "php71-intl" ==> Searching for a previously deleted formula (in the last month)... Warning: homebrew/core is shallow clone. To get complete history run: git -C "$(brew --repo homebrew/core)" fetch --unshallow

Error: No previously deleted formula found. ==> Searching for similarly named formulae... Error: No similarly named formulae found. ==> Searching taps... ==> Searching taps on GitHub... Error: No formulae found in taps.

となってしまった。

この記事によるとHomebrewをre installするらしい。

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)" /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

なおこれをやるとVimで" * y yのコマンドが動かなくなる。

PATH

これでしてみたがまだ which phpをすると usr/bin/になってしまう。 usr/local..にならない。

Teratailで回答を頂いて解決した。 teratail

export PATH=$PATH:/usr/local/opt/php@7.1/bin/php
になっていたのを
export PATH=/usr/local/opt/php@7.1/bin/php:$PATH
で逆にして

export PATH=/usr/local/opt/php@7.1/bin:$PATH
で最後のphpという実行ファイルの指定を消してintlが動いた。 kabaoさんありがとうございます。

確かにパスを通すのにfileを指定するのは変だ。

これでcakePHPのprojectがようやくstartできる!!!