Quantcast
Channel: PHP7.4タグが付けられた新着記事 - Qiita
Viewing all articles
Browse latest Browse all 113

MacOSをCatalinaにしてphpが動作しなくなったら

$
0
0

MacOSのバージョンアップ時の定期事故である、phpenvの再インストール

phpが動かなくなった時の対応

よくmacosのバージョンをあげたらいきなりphpが動かなくなることが多いです。
今まで毎回そうだったのでもう定期事故として考えています。面倒だけど、仕方なく新しいの使いたいから今回もバージョンアップ!

$ php -v
dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.64.dylib
  Referenced from: /Users/syokatsu/.phpenv/versions/7.3.13/bin/php
  Reason: image not found
zsh: abort      php -v

やはりこれか〜!
icu4cの問題は以前もあったので、気軽に次のステップへ

まずはphp-buildのバージョンアップから!

php-buildのバージョンアップ

$ cd ~/.phpenv/plugins/php-build
$ git pull

今まではphp7.3系を利用していたが、php7.4が落ちてきたのでそろそろphp7.4系をinstallすることに!

php7.4のinstall

関連libraryインストール。必要なのは色々あるはずなので、必要な物をinstall

$ brew install bzip2 icu4c krb5 libedit libzip oniguruma openssl@1.1 pkg-config tidy-html5
$ vi ~/.phpenv/plugins/php-build/share/php-build/default_configure_options
~~
この内容を追加
--with-zlib-dir=/usr/local/opt/zlib
--with-bz2=/usr/local/opt/bzip2
--with-libedit=/usr/local/opt/libedit
~~

$ vi ~/.zshrc
export PKG_CONFIG_PATH="/usr/local/opt/krb5/lib/pkgconfig:/usr/local/opt/icu4c/lib/pkgconfig:/usr/local/opt/libedit/lib/pkgconfig:/usr/local/opt/libjpeg/lib/pkgconfig:/usr/local/opt/libpng/lib/pkgconfig:/usr/local/opt/libxml2/lib/pkgconfig:/usr/local/opt/libzip/lib/pkgconfig:/usr/local/opt/oniguruma/lib/pkgconfig:/usr/local/opt/openssl@1.1/lib/pkgconfig:/usr/local/opt/tidy-html5/lib/pkgconfig" 

phpのinstall

$ phpenv install 7.4.6
...
[Success]: Built 7.4.6 successfully.

$ phpenv global 7.4.6
$ php -v
PHP 7.4.6 (cli) (built: May 23 2020 01:07:57) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.6, Copyright (c), by Zend Technologies
    with Xdebug v2.9.5, Copyright (c) 2002-2020, by Derick Rethans

Viewing all articles
Browse latest Browse all 113

Trending Articles