php5 のbuild 3
前にちょっと時間が取れなくて断念した、php5 のソースからのbuild
とりあえず、GDを入れるところからメモ記載。
●GDインストール
yum で libxml2-devel、freetype-devel、libjpeg-devel、libpng-develをインストール
# yum install libxml2-devel freetype-devel libjpeg-devel libpng-devel
その後、libiconvのインストール。
ここはソースから。
# wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.9.2.tar.gz
# tar xzfv libiconv-1.9.2.tar.gz -C /usr/local/src/
# cd /usr/local/src/libiconv-1.9.2/
# ./configure
# make
# make install
# /sbin/ldconfig
そして、GDのインストール。
# tar xzvf gd-2.0.32.tar.gz -C /usr/local/src
# cd /usr/local/src/gd-2.0.32
# ./configure
# make
# make install
-----
●PHPインストール
・事前インストール
# yum install aspell-devel curl curl-devel \
libelf-devel libxslt libxslt-devel libxml2-devel \
libjpeg-devel libpng-devel libgcrypt libgcrypt-devel \
libtiff libtiff-devel net-snmp-devel t1lib t1lib-devel
いっぱいあるので、各々については後ほど。
・さらに、libmcryptのインストール。
ソースから。
# wget http://www.uhero.co.jp/src/libmcrypt-2.5.7.tar.gz
# tar xzfv libmcrypt-2.5.7.tar.gz -C /usr/local/src/
# cd /usr/local/src/libmcrypt-2.5.7
# ./configure
# make
# make install
・PHP 本体のダウンロード
# wget http://au.php.net/get/php-5.2.3.tar.gz/from/jp.php.net/mirror
# tar xzfv php-5.2.3.tar.gz -C /usr/local/src/
# cd /usr/local/src/php-5.2.3
--コンパイルでエラー
/usr/local/src/php-5.2.3/ext/mysqli/mysqli_api.c: In function 'zif_mysqli_stmt_bind_param':
/usr/local/src/php-5.2.3/ext/mysqli/mysqli_api.c:144: error: 'gptr' undeclared (first use in this function)
/usr/local/src/php-5.2.3/ext/mysqli/mysqli_api.c:144: error: (Each undeclared identifier is reported only once
/usr/local/src/php-5.2.3/ext/mysqli/mysqli_api.c:144: error: for each function it appears in.)
/usr/local/src/php-5.2.3/ext/mysqli/mysqli_api.c: In function 'zif_mysqli_stmt_execute':
/usr/local/src/php-5.2.3/ext/mysqli/mysqli_api.c:603: error: 'gptr' undeclared (first use in this function)
make: *** [ext/mysqli/mysqli_api.lo] エラー 1
どうやら、mysql 5.1.20 から何かが変更されたとか…。
mysqli で問題があるらしい。
/usr/local/src/php-5.2.3/ext/mysqli/mysqli_api.c を、
-> ここの修正箇所を参考にして修正。
c-1)
switch (types[ofs]) {
case 'd': /* Double */
~~
bind[ofs].buffer = (gptr)&Z_DVAL_PP(args[i]);
↓↓
bind[ofs].buffer = &Z_DVAL_PP(args[i]);
case 'i': /* Integer */
~~
bind[ofs].buffer = (gptr)&Z_LVAL_PP(args[i]);
↓↓
bind[ofs].buffer = &Z_LVAL_PP(args[i]);
c-2)
for (i = 0; i < stmt->param.var_cnt; i++) {
if (stmt->param.vars[i]) {
if ( !(stmt->param.is_null[i] = (stmt->param.vars[i]->type == IS_NULL)) ) {
の
switch (stmt->stmt->params[i].buffer_type) {
case MYSQL_TYPE_DOUBLE:
~~
stmt->stmt->params[i].buffer = (gptr)&Z_LVAL_PP(&stmt->param.vars[i]);
↓↓
stmt->stmt->params[i].buffer = &Z_LVAL_PP(&stmt->param.vars[i]);
case MYSQL_TYPE_LONG:
~~
stmt->stmt->params[i].buffer = (gptr)&Z_LVAL_PP(&stmt->param.vars[i]);
↓↓
stmt->stmt->params[i].buffer = &Z_LVAL_PP(&stmt->param.vars[i]);
上記修正にて、エラー回避。コンパイルは完了。
※ コンパイルオプションは、後記
次に、make
--makeでエラー 1
/usr/bin/ld: cannot find -lltdl
collect2: ld returned 1 exit status
make: *** [libphp5.la] エラー 1
原因:-lltdl が見つからない
lltdl = libtool らしい … インストール済
そこで回避方法を見てやってみた。
# cd /usr/local/src/libmcrypt-2.5.7/libltdl
# ./configure --enable-ltdl-install
# make
# make install
# make clean
この問題は無事回避できた。
--makeにてエラー 2
ext/iconv/.libs/iconv.o: In function `php_iconv_stream_filter_ctor':/usr/local/src/php-5.2.3/ext/iconv/iconv.c:2426:
undefined reference to `libiconv_open'
collect2: ld returned 1 exit status
make: *** [sapi/cli/php] エラー 1
原因:libiconvのリンクパスが通っていないのが原因らしい
# less /etc/ld.so.conf
に、
/usr/local/lib (libiconvをインストールしたパス)を追加
/etc/ld.so.confの編集を/etc/ld.so.cacheに反映させるため次のコマンドを実行する。
# /sbin/ldconfig
および、phpのコンパイルオプションに下記を追加
--with-iconv=/usr/local \
上記対処にて、
# cd /usr/local/src/php-5.2.3
# make
makeが通る。その後、
# make install
で無事完了。
前回のlinphp5.soの問題は、オプションを最低限の状態でインストール、
その後、
# make clean
# make dist-clean
して、今度はオプションを付けてインストールしたら、エラー回避できた。
今回は、オプションを増やした影響でエラーが出た模様。
*** コンパイルオプションの指定 ***
# ./configure \
--prefix=/usr \
--enable-calendar \
--enable-dba \
--enable-dbx \
--enable-dio \
--enable-dom \
--enable-exif \
--enable-ftp \
--enable-gd-jis-conv \
--enable-gd-native-ttf \
--enable-mbstring \
--enable-module=so \
--enable-shmop \
--enable-soap \
--enable-sockets \
--enable-xml \
--enable-zend-multibyte \
--with-config-file-path=/etc \
--with-apxs2=/etc/httpd/bin/apxs \
--with-bz2 \
--with-gd \
--with-gettext \
--with-inifile \
--with-iconv=/usr/local \
--with-ldap \
--with-ldap-sasl \
--with-libxml \
--with-curl \
--with-curlwrappers \
--with-mcrypt \
--with-mime-magic \
--with-mysql=/usr/local/mysql5 \
--with-mysqli=/usr/local/mysql5/bin/mysql_config \
--with-openssl \
--with-pcre-regex \
--with-pear \
--with-pspell \
--with-t1lib \
--with-ttf \
--with-xml \
--with-xsl \
--with-zlib \
--with-zlib-dir
**********************************
とりあえず、GDを入れるところからメモ記載。
●GDインストール
yum で libxml2-devel、freetype-devel、libjpeg-devel、libpng-develをインストール
# yum install libxml2-devel freetype-devel libjpeg-devel libpng-devel
その後、libiconvのインストール。
ここはソースから。
# wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.9.2.tar.gz
# tar xzfv libiconv-1.9.2.tar.gz -C /usr/local/src/
# cd /usr/local/src/libiconv-1.9.2/
# ./configure
# make
# make install
# /sbin/ldconfig
そして、GDのインストール。
# tar xzvf gd-2.0.32.tar.gz -C /usr/local/src
# cd /usr/local/src/gd-2.0.32
# ./configure
# make
# make install
-----
●PHPインストール
・事前インストール
# yum install aspell-devel curl curl-devel \
libelf-devel libxslt libxslt-devel libxml2-devel \
libjpeg-devel libpng-devel libgcrypt libgcrypt-devel \
libtiff libtiff-devel net-snmp-devel t1lib t1lib-devel
いっぱいあるので、各々については後ほど。
・さらに、libmcryptのインストール。
ソースから。
# wget http://www.uhero.co.jp/src/libmcrypt-2.5.7.tar.gz
# tar xzfv libmcrypt-2.5.7.tar.gz -C /usr/local/src/
# cd /usr/local/src/libmcrypt-2.5.7
# ./configure
# make
# make install
・PHP 本体のダウンロード
# wget http://au.php.net/get/php-5.2.3.tar.gz/from/jp.php.net/mirror
# tar xzfv php-5.2.3.tar.gz -C /usr/local/src/
# cd /usr/local/src/php-5.2.3
--コンパイルでエラー
/usr/local/src/php-5.2.3/ext/mysqli/mysqli_api.c: In function 'zif_mysqli_stmt_bind_param':
/usr/local/src/php-5.2.3/ext/mysqli/mysqli_api.c:144: error: 'gptr' undeclared (first use in this function)
/usr/local/src/php-5.2.3/ext/mysqli/mysqli_api.c:144: error: (Each undeclared identifier is reported only once
/usr/local/src/php-5.2.3/ext/mysqli/mysqli_api.c:144: error: for each function it appears in.)
/usr/local/src/php-5.2.3/ext/mysqli/mysqli_api.c: In function 'zif_mysqli_stmt_execute':
/usr/local/src/php-5.2.3/ext/mysqli/mysqli_api.c:603: error: 'gptr' undeclared (first use in this function)
make: *** [ext/mysqli/mysqli_api.lo] エラー 1
どうやら、mysql 5.1.20 から何かが変更されたとか…。
mysqli で問題があるらしい。
/usr/local/src/php-5.2.3/ext/mysqli/mysqli_api.c を、
-> ここの修正箇所を参考にして修正。
c-1)
switch (types[ofs]) {
case 'd': /* Double */
~~
bind[ofs].buffer = (gptr)&Z_DVAL_PP(args[i]);
↓↓
bind[ofs].buffer = &Z_DVAL_PP(args[i]);
case 'i': /* Integer */
~~
bind[ofs].buffer = (gptr)&Z_LVAL_PP(args[i]);
↓↓
bind[ofs].buffer = &Z_LVAL_PP(args[i]);
c-2)
for (i = 0; i < stmt->param.var_cnt; i++) {
if (stmt->param.vars[i]) {
if ( !(stmt->param.is_null[i] = (stmt->param.vars[i]->type == IS_NULL)) ) {
の
switch (stmt->stmt->params[i].buffer_type) {
case MYSQL_TYPE_DOUBLE:
~~
stmt->stmt->params[i].buffer = (gptr)&Z_LVAL_PP(&stmt->param.vars[i]);
↓↓
stmt->stmt->params[i].buffer = &Z_LVAL_PP(&stmt->param.vars[i]);
case MYSQL_TYPE_LONG:
~~
stmt->stmt->params[i].buffer = (gptr)&Z_LVAL_PP(&stmt->param.vars[i]);
↓↓
stmt->stmt->params[i].buffer = &Z_LVAL_PP(&stmt->param.vars[i]);
上記修正にて、エラー回避。コンパイルは完了。
※ コンパイルオプションは、後記
次に、make
--makeでエラー 1
/usr/bin/ld: cannot find -lltdl
collect2: ld returned 1 exit status
make: *** [libphp5.la] エラー 1
原因:-lltdl が見つからない
lltdl = libtool らしい … インストール済
そこで回避方法を見てやってみた。
# cd /usr/local/src/libmcrypt-2.5.7/libltdl
# ./configure --enable-ltdl-install
# make
# make install
# make clean
この問題は無事回避できた。
--makeにてエラー 2
ext/iconv/.libs/iconv.o: In function `php_iconv_stream_filter_ctor':/usr/local/src/php-5.2.3/ext/iconv/iconv.c:2426:
undefined reference to `libiconv_open'
collect2: ld returned 1 exit status
make: *** [sapi/cli/php] エラー 1
原因:libiconvのリンクパスが通っていないのが原因らしい
# less /etc/ld.so.conf
に、
/usr/local/lib (libiconvをインストールしたパス)を追加
/etc/ld.so.confの編集を/etc/ld.so.cacheに反映させるため次のコマンドを実行する。
# /sbin/ldconfig
および、phpのコンパイルオプションに下記を追加
--with-iconv=/usr/local \
上記対処にて、
# cd /usr/local/src/php-5.2.3
# make
makeが通る。その後、
# make install
で無事完了。
前回のlinphp5.soの問題は、オプションを最低限の状態でインストール、
その後、
# make clean
# make dist-clean
して、今度はオプションを付けてインストールしたら、エラー回避できた。
今回は、オプションを増やした影響でエラーが出た模様。
*** コンパイルオプションの指定 ***
# ./configure \
--prefix=/usr \
--enable-calendar \
--enable-dba \
--enable-dbx \
--enable-dio \
--enable-dom \
--enable-exif \
--enable-ftp \
--enable-gd-jis-conv \
--enable-gd-native-ttf \
--enable-mbstring \
--enable-module=so \
--enable-shmop \
--enable-soap \
--enable-sockets \
--enable-xml \
--enable-zend-multibyte \
--with-config-file-path=/etc \
--with-apxs2=/etc/httpd/bin/apxs \
--with-bz2 \
--with-gd \
--with-gettext \
--with-inifile \
--with-iconv=/usr/local \
--with-ldap \
--with-ldap-sasl \
--with-libxml \
--with-curl \
--with-curlwrappers \
--with-mcrypt \
--with-mime-magic \
--with-mysql=/usr/local/mysql5 \
--with-mysqli=/usr/local/mysql5/bin/mysql_config \
--with-openssl \
--with-pcre-regex \
--with-pear \
--with-pspell \
--with-t1lib \
--with-ttf \
--with-xml \
--with-xsl \
--with-zlib \
--with-zlib-dir
**********************************
by tairand | 2007-08-09 16:33 | LAMP/LAPP