KAEDE Hack blog

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

Solved CakePHP intl ERR

installation

  • In cakePHP quick start, I stocked.
  • this is how I solved the problem and made a Cake Project.

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が必要?になってしまった f:id:kei_s_lifehack:20190927015035j:plain

yum

No yum in MacOS.

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のコマンドが動かなくなる。

=> vim --versionをするとVim8.0になっている。
また:terminalも
"E319: Sorry, the command is not available in this version"
と出てしまう。 blog の記事でやった通りにupdateをした。今回はPATHを書かなくても
which vim

/usr/local/bin/vim
に通って、
vim --version
VIM - Vi IMproved 8.1 (2018 May 18, compiled Apr 11 2019 17:46:54) macOS version でVim8.1に戻せた。

PATH

brew install php71を使って /usr/local/optにvim@8.1と同じようにphp@7.1が入っている状態にします。

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

solved

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を指定するのは変だ。

new PB

need SQL PATH

  • Incremented /App/XAMPP/etc/my.conf
    • port 3308
  • but don't work.
  • add export PATH=/Applications/XAMPP/bin:$PATH$
  • will not work.

  • Running XAMPP again solved this Problem.

No php intl

In my env,
/Applications/XAMPP/xamppfiles/etc,
php.ini exists.
This article said to add extension=intl.so to php.ini.
(http://tusukuru.hatenablog.com/entry/2016/05/31/024601)

I changed this, deleted comment mark and changed.
intl.dll to intl.so
but it just changes this err msg

kaede$ php -i | grep intl
PHP Warning:  PHP Startup: Unable to load dynamic library '/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20160303/php_intl.so' - dlopen(/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20160303/php_intl.so, 9): image not found in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library '/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20160303/php_intl.so' - dlopen(/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20160303/php_intl.so, 9): image not found in Unknown on line 0 

This is php err.

  • Of cousrse, deleting this line in php.ini causes:
bin/cake server
PHP Fatal error:  You must enable the intl extension to use CakePHP.
 in /Users/kaede/code/cake/cms/config/requirements.php on line 31

Finding intl

sudo find / -name *intl.so 2> /dev/null

returns (Mac)

/opt/local/lib/php71/extensions/no-debug-non-zts-20160303/intl.so

returns(WSL Ubuntu) (did not need anything)

/opt/lampp/lib/preloadable_libintl.so
````

### Move to the proper place

sudo cp /opt/local/lib/php71/extensions/no-debug-non-zts-20160303/intl.so /Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20160303/

I renamed intl file name.   
´mv intl.so php_intl.so´  
* because this is in warning, so I changed intl file name.  
Then I run....  
`php composer.phar create-project --prefer-dist cakephp/app cms`    


It worked!!!!!

### What caused this, まとめ,なぜ起きたか.
XAMPP php71 will not provide intl.so,  
but PHP requires php_intl.so.  
So I needed to bring intl from brew-made php,  
and change the name as PHP wanted.  

Special thank: stmt.  


<EOF>