LoginSignup
2
4

More than 5 years have passed since last update.

phpenv入れようとしたらrbenvと干渉して動かなかった話

Last updated at Posted at 2017-05-06

phpenvはrbenvを利用して動いているっぽい

現象としては、phpenvをインストールした後に、
phpenv -v
をすると
rbenvのバージョンが出て来るし、
phpenv install
しようとするとrubyをインストールしようとする。

どうやらrbenvの機能を利用しているのがphpenvなのかな。

参照:
http://qiita.com/sato_ryu/items/47db3277ad32a0d7b491
http://qiita.com/fgnhssb/items/2263c79284c612c7d6ed

とりあえずphpをバージョン管理できればいい

anyenvなるものを導入すると、***env系のものが鑑賞せずに管理できるということですが、仕組みがよくわからないものをいれちゃうのはあんまりよくないですし、php触ったことない勢にとっては、まずは動かすことが大事なので、とりあえずrbenvと干渉しないphpbrewにしました。
こちらを参考にphpbrewをインストールします。
http://www.karakaram.com/mac-install-phpbrew

これが最適な環境構築かは分からないので、phpを一通り触ってみて、必要があれば環境構築をし直すつもりです。

おまけ phpbrewの挙動

% phpbrew known                               
Read local release list (last update: 2017-05-06 08:47:08 UTC).
You can run `phpbrew update` or `phpbrew known --update` to get a newer release list.
7.1: 7.1.4, 7.1.3, 7.1.2, 7.1.1, 7.1.0 ...
7.0: 7.0.18, 7.0.17, 7.0.16, 7.0.15, 7.0.14, 7.0.13, 7.0.12, 7.0.11 ...
5.6: 5.6.30, 5.6.29, 5.6.28, 5.6.27, 5.6.26, 5.6.25, 5.6.24, 5.6.23 ...
5.5: 5.5.38, 5.5.37, 5.5.36, 5.5.35, 5.5.34, 5.5.33, 5.5.32, 5.5.31 ...
5.4: 5.4.45, 5.4.44, 5.4.43, 5.4.42, 5.4.41, 5.4.40, 5.4.39, 5.4.38 ...


そこで、
% phpbrew install 5.6.30
を実行してみると...

Error: Make failed:
The last 5 lines in the log file:
/Users/hoge/.phpbrew/build/php-5.6.30/ext/openssl/openssl.c:44:10: fatal error: 'openssl/evp.h' file not found

#include <openssl/evp.h>

         ^

1 error generated.

make: *** [ext/openssl/openssl.lo] Error 1

Please checkout the build log file for more details:
     tail /Users/hoge/.phpbrew/build/php-5.6.30/build.log

なんてこったいインストールできないぜ\(^o^)/

に詳しく解説されているのでこちらを参考に設定してあげて下さい。
ちなみに私は上記で解決できず、、、こちらで対応しました。
phpbrewの場合はこれを読み込むとよさそう。

phpbrew install 5.6.30 +default
コレでインストールできました。

cakePHP触るために...

cakePHP触る関係で以下のようにしてインストールし直しました。

phpbrew install 5.6.30 +default -- --enable-intl

ちなみにコレもエラー出ました。

checking for icu-config... no
checking for location of ICU headers and libraries... not found
configure: error: Unable to detect ICU prefix or no failed. Please verify ICU install prefix and make sure icu-config works.

こいつを通すためには、

brew install intltool icu4c

でOK。やっと無事に環境が整ってきた。

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