LoginSignup
2
1

More than 1 year has passed since last update.

M1 Macbook Proにasdfを導入して複数バージョンのPHPをインストールする

Last updated at Posted at 2023-02-28

asdf導入

インストール

  • brewを使ってインストール
brew install asdf
echo -e "\n# for asdf\n. $(brew --prefix asdf)/libexec/asdf.sh" >> ~/.zshrc

基本操作

  • 使用できるプラグインを表示
asdf plugin list all
  • プラグインのインストール
asdf plugin add <name>
  • 使用できるバージョンの表示
asdf list all <name>
  • バージョンのインストール
asdf install <name> <version>
  • 使用するバージョンの指定
asdf global <name> <version>
or
asdf local <name> <version>

PHPインストール

  • 依存関係のあるライブラリ群をインストール
    • 不足している際に発生するエラーは後述。
brew install bison re2c pkg-config libiconv oniguruma libzip
  • phpインストール
asdf plugin add php
asdf list all php
asdf install php 8.2.3

エラー

依存関係のあるライブラリが不足している場合

  • bison
configure: error: bison 3.0.0 or later is required to generate PHP parsers (excluded versions: none).
  • re2c
configure: error: re2c 0.13.4 is required to generate PHP lexers.
  • pkg-config
configure: error: in `/var/folders/d0/88syyrq97098_c1mx8pr224jm1137v/T/php-src-php-8.2.3':
configure: error: The pkg-config script could not be found or is too old.  Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config.
  • libiconv
configure: error: Please specify the install prefix of iconv with --with-iconv=<DIR>
  • oniguruma
configure: error: Package requirements (oniguruma) were not met:
  • libzip
configure: error: Package requirements (libzip >= 0.11 libzip != 1.3.1 libzip != 1.7.0) were not met:
2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1