LoginSignup
2
2

More than 5 years have passed since last update.

php-buildが動かなくなったので対応メモ

Posted at

概要

phpenvとphp-buildを使ってphpのバージョン管理をしている環境を想定。手元のPHPのバージョンを5.3から5.4に上げようと思ってphp-buildしようかと思ったら以下のようにエラー詳細が何も出ず困ったので対応メモ。

-----------------
|  BUILD ERROR  |
-----------------

Here are the last 10 lines from the log:

-----------------------------------------
-----------------------------------------

対応

1. brewパッケージの更新

php-buildのバージョンアップをします。
現時点では v0.10.0 が最新のようです。

$ brew update && brew upgrade

2. tar.bz2 をダウンロード

この段階でphp-buildすると以下のようなエラーとなります。
(エラー詳細が出てくれるようになりました。)

-----------------
|  BUILD ERROR  |
-----------------

Here are the last 10 lines from the log:

-----------------------------------------
curl: (22) The requested URL returned error: 404
-----------------------------------------

phpのtarballをダウンロードする時点でこけてしまうのであらかじめダウンロードして処理をスキップさせます。
http://php.net/releases/ から好きなバージョンのtarballをダウンロードしてきます。

3. tarballをphp-build用のディレクトリにコピー

$ cp ~/Downloads/php-5.4.16.tar.bz2 /var/tmp/php-build/packages

4. libzが見つからないので対応

3.までの手順を終わらせて再度php-buildしようとすると以下のエラーが出ました。

Here are the last 10 lines from the log:

-----------------------------------------
rm: conftest.dSYM: is a directory
configure: error: Cannot find libz
-----------------------------------------

こちらの記事 を参考に対応

$ xcode-select --install

ポップアップが出てくるので同意してインストールします。

5. 準備完了

再度コマンド実行してインストールできることを確認!

$ php-build 5.4.16 ~/.phpenv/versions/5.4.16

参考

2
2
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
2