既存のPHP削除
# yum remove php*
===================================================================================================================================
Package Arch Version Repository Size
===================================================================================================================================
Removing:
php54w x86_64 5.4.10-1.w6 @webtatic 4.2 M
php54w-cli x86_64 5.4.10-1.w6 @webtatic 7.3 M
php54w-common x86_64 5.4.10-1.w6 @webtatic 3.6 M
php54w-devel x86_64 5.4.10-1.w6 @webtatic 3.7 M
php54w-mbstring x86_64 5.4.10-1.w6 @webtatic 1.2 M
php54w-mcrypt x86_64 5.4.10-1.w6 @webtatic 44 k
php54w-mysql x86_64 5.4.10-1.w6 @webtatic 219 k
php54w-pdo x86_64 5.4.10-1.w6 @webtatic 170 k
警告: /etc/php.ini は /etc/php.ini.rpmsave として保存されました。
ソースコード
# wget http://php.net/get/php-5.4.10.tar.gz/from/this/mirror
# tar xvzf php-5.4.10.tar.gz
必要なライブラリ群
---
ncurses*
gcc-c++
flex
libxml*
gdbm*
gd gd-devel freetype libpng libmng* libtiff* libjpeg* libc-client* giflib*
httpd-devel
pcre-devel
unixODBC-devel
net-snmp-devel
openssl*
bzip2*
db4*
gmp*
libc-client*
openldap*
libmcrypt*
mhash*
freetds*
aspell*
readline*
libtidy*
libxslt*
libtool*
curl*
(mysql*)
(memcache*)
---
conf.sh作成
-----
#!/bin/sh
make clean
./configure \
--with-apxs2=/usr/sbin/apxs \
--build=x86_64-redhat-linux-gnu \
--host=x86_64-redhat-linux-gnu \
--target=x86_64-redhat-linux-gnu \
--prefix=/usr \
--exec-prefix=/usr \
--bindir=/usr/bin \
--sbindir=/usr/sbin \
--sysconfdir=/etc \
--datadir=/usr/share \
--includedir=/usr/include \
--libdir=/usr/lib64 \
--libexecdir=/usr/libexec \
--localstatedir=/var \
--sharedstatedir=/var/lib \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--cache-file=../config.cache \
--with-libdir=lib64 \
--with-config-file-path=/etc \
--with-config-file-scan-dir=/etc/php.d \
--with-jpeg-dir=/usr \
--with-png-dir=/usr \
--with-mysqli=mysqlnd \
--with-gd \
--with-mcrypt=/usr/local/lib \
--with-zlib=/usr \
--with-mhash=/usr/local/lib \
--without-mssql \
--with-openssl \
--enable-mbstring \
--enable-mbregex \
--enable-exif \
--enable-ftp \
--enable-zip \
--enable-gd-native-ttf \
--enable-gd-jis-conv \
--enable-calendar \
--enable-mysqlnd \
--enable-sysvmsg \
--enable-bcmath
-----
エラーが無ければmake
# make
# make test
=====================================================================
FAILED TEST SUMMARY
---------------------------------------------------------------------
Bug #63398 (Segfault when polling closed link) [ext/mysqli/tests/bug63398.phpt]
Bug #32001 (xml_parse*() goes into infinite loop when autodetection in effect), using UTF-* [ext/xml/tests/bug32001.phpt]
XMLReader: libxml2 XML Reader, DTD [ext/xmlreader/tests/008.phpt]
XMLReader: accessing empty and non existing attributes [ext/xmlreader/tests/012.phpt]
=====================================================================
テスト失敗してるけど気にしない
# make install
Installing PHP SAPI module: apache2handler
/usr/lib64/httpd/build/instdso.sh SH_LIBTOOL='/usr/lib64/apr-1/build/libtool' libphp5.la /usr/lib64/httpd/modules
/usr/lib64/apr-1/build/libtool --mode=install cp libphp5.la /usr/lib64/httpd/modules/
libtool: install: cp .libs/libphp5.so /usr/lib64/httpd/modules/libphp5.so
libtool: install: cp .libs/libphp5.lai /usr/lib64/httpd/modules/libphp5.la
libtool: install: warning: remember to run `libtool --finish /root/php/php-5.4.10/libs'
chmod 755 /usr/lib64/httpd/modules/libphp5.so
[activating module `php5' in /etc/httpd/conf/httpd.conf]
Installing PHP CLI binary: /usr/bin/
Installing PHP CLI man page: /usr/share/man/man1/
Installing PHP CGI binary: /usr/bin/
Installing build environment: /usr/lib64/build/
Installing header files: /usr/include/php/
Installing helper programs: /usr/bin/
program: x86_64-redhat-linux-gnu-phpize
program: x86_64-redhat-linux-gnu-php-config
Installing man pages: /usr/share/man/man1/
page: x86_64-redhat-linux-gnu-phpize.1
page: x86_64-redhat-linux-gnu-php-config.1
Installing PEAR environment: /usr/lib64/php/
[PEAR] Archive_Tar - installed: 1.3.7
[PEAR] Console_Getopt - installed: 1.3.0
[PEAR] Structures_Graph- installed: 1.0.4
[PEAR] XML_Util - installed: 1.2.1
[PEAR] PEAR - installed: 1.9.4
Wrote PEAR system config file at: /etc/pear.conf
You may want to add: /usr/lib64/php to your php.ini include_path
/root/php/php-5.4.10/build/shtool install -c ext/phar/phar.phar /usr/bin
ln -s -f /usr/bin/phar.phar /usr/bin/phar
Installing PDO headers: /usr/include/php/ext/pdo/
> You may want to add: /usr/lib64/php to your php.ini include_path
/usr/lib64/php にphp.iniをコピー
追記:
わからんけどphpコマンドが通らない!
# ls /usr/bin/*php*
/usr/bin/x86_64-redhat-linux-gnu-php /usr/bin/x86_64-redhat-linux-gnu-php-config
/usr/bin/x86_64-redhat-linux-gnu-php-cgi /usr/bin/x86_64-redhat-linux-gnu-phpize
どうやら変な所に配置されちゃったぽいので
# cd /usr/bin/
# ln -s x86_64-redhat-linux-gnu-php php