あいつの日誌β

働きながら旅しています。

MacOSX に PHP 5.4.29 を install したい

試みた

% anyenv install phpenv
% exec -l $SHELL
% phpenv install 5.4.29

だがしかしうまくいかない

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

Here are the last 10 lines from the log:

-----------------------------------------
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
configure: error: jpeglib.h not found.
-----------------------------------------

The full Log is available at '/tmp/php-build.5.4.29.20150708112812.log'.
[Warn]: Aborting build.

というわけで re2c と libjpeg を入れておく

% brew install re2c libjpeg

再度挑戦

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

Here are the last 10 lines from the log:

-----------------------------------------
configure: error: png.h not found.
-----------------------------------------

The full Log is available at '/tmp/php-build.5.4.29.20150708113052.log'.
[Warn]: Aborting build.

こんどは libpng が足りないので入れる

% brew install libpng

次はこう言われる

configure: error: mcrypt.h not found. Please reinstall libmcrypt.
% brew install libmcrypt

今度はこのようなエラー

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

Here are the last 10 lines from the log:

-----------------------------------------
^
Zend/zend_vm_execute.h:36572:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
12 warnings generated.
/var/tmp/php-build/source/5.4.29/sapi/cgi/cgi_main.c:1825:10: warning: assigning to 'unsigned char *' from 'char *' converts between pointers to integer types with different sign [-Wpointer-sign]
                for (p = decoded_query_string; *p &&  *p <= ' '; p++) {
                       ^ ~~~~~~~~~~~~~~~~~~~~
1 warning generated.
PEAR package PHP_Archive not installed: generated phar will require PHP's phar extension be enabled.
-----------------------------------------

なんとなくPEAR package PHP_Archive not installed: generated phar will require PHP's phar extension be enabled.Google 検索したら以下の記事が見つかった

http://hirobanex.net/article/2013/09/1379231000

書かれている通りに autoconf を入れるとビルドできた

% brew install autoconf

まとめ

MacOSX で phpenv 使う場合はとりあえず以下を先に実行しておくといいみたい

% brew install re2c libjpeg libpng libmcrypt autoconf