notebook

都内でWEB系エンジニアやってます。

php update作業

  • 5.3.10 -> 5.6.10

もはや、化石と化したシステムのメンテ

特にフレームワークを使っているわけでも難しいことをやっているわけではないので特に問題はなかったけど、色々作業はしたのでその時のメモ

テスト環境

$ php -i | grep configure
Configure Command =>  './configure'

何も指定してない

yum install BZip2
  • ソースの取得
wget http://jp2.php.net/get/php-5.6.10.tar.gz/from/this/mirror
tar xvf php-5.6.10.tar.gz
cd php-5.6.10
./configure
make test
make install
php -version
PHP 5.6.10 (cli) (built: Jun 23 2015 12:19:32)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
  • apache再起動、動作確認

テスト環境は特に何も苦労なし

本番

configureオプションを確認

$ php -i | grep configure |  sed -e "s/'//g"
Configure Command =>  ./configure  --build=i686-redhat-linux-gnu --host=i686-redhat-linux-gnu --target=i386-redhat-linux-gnu --program-prefix= --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/usr/com --mandir=/usr/share/man --infodir=/usr/share/info --cache-file=../config.cache --with-libdir=lib --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --disable-debug --with-pic --disable-rpath --without-pear --with-bz2 --with-exec-dir=/usr/bin --with-freetype-dir=/usr --with-png-dir=/usr --with-xpm-dir=/usr --enable-gd-native-ttf --with-t1lib=/usr --without-gdbm --with-gettext --with-gmp --with-iconv --with-jpeg-dir=/usr --with-openssl --with-zlib --with-layout=GNU --enable-exif --enable-ftp --enable-magic-quotes --enable-sockets --with-kerberos --enable-ucd-snmp-hack --enable-shmop --enable-calendar --with-libxml-dir=/usr --enable-xml --with-system-tzdata --with-mhash --enable-force-cgi-redirect --libdir=/usr/lib/php --enable-pcntl --with-imap=shared --with-imap-ssl --enable-mbstring=shared --enable-mbregex --with-gd=shared --enable-bcmath=shared --enable-dba=shared --with-db4=/usr --with-xmlrpc=shared --with-ldap=shared --with-ldap-sasl --enable-mysqlnd=shared --with-mysql=shared,mysqlnd --with-mysqli=shared,mysqlnd --with-mysql-sock=/var/lib/mysql/mysql.sock --with-oci8=shared,instantclient,/usr/lib/oracle/11.2/client/lib,11.2 --with-pdo-oci=shared,instantclient,/usr,11.2 --with-interbase=shared,/usr/lib/firebird --with-pdo-firebird=shared,/usr/lib/firebird --enable-dom=shared --with-pgsql=shared --enable-wddx=shared --with-snmp=shared,/usr --enable-soap=shared --with-xsl=shared,/usr --enable-xmlreader=shared --enable-xmlwriter=shared --with-curl=shared,/usr --enable-fastcgi --enable-pdo=shared --with-pdo-odbc=shared,unixODBC,/usr --with-pdo-mysql=shared,mysqlnd --with-pdo-pgsql=shared,/usr --with-pdo-sqlite=shared,/usr --with-pdo-dblib=shared,/usr --without-sqlite3 --with-sqlite=shared,/usr --enable-json=shared --enable-zip=shared --without-readline --with-libedit --with-pspell=shared --enable-phar=shared --with-mcrypt=shared,/usr --with-tidy=shared,/usr --with-mssql=shared,/usr --enable-sysvmsg=shared --enable-sysvshm=shared --enable-sysvsem=shared --enable-posix=shared --with-unixODBC=shared,/usr --enable-fileinfo=shared --enable-intl=shared --with-icu-dir=/usr --with-enchant=shared,/usr --with-recode=shared,/usr

(゚д゚;)

なんか色々付けている。。。

そもそもテスト環境と環境違うのもあれなのでテスト環境で同一コンパイルオプションでインストールできるように試行錯誤してみた


  • エラー
Please reinstall the BZip2 distribution
  • bzip2
yum install -y bzip2 bzip2-devel

  • エラー
Please reinstall the libcurl distribution
yum install -y curl-devel

  • エラー
configure: error: Cannot find enchant
  • enchant
yum install -y enchant-devel

  • エラー
configure: error: jpeglib.h not found
  • libjpeg
yum install -y libjpeg-devel

  • エラー
configure: error: png.h not found.
  • libpng
yum install -y libpng-devel

  • エラー
configure: error: xpm.h not found.
  • libXpm
yum install -y libXpm-devel

  • エラー
configure: error: freetype-config not found.
yum install -y freetype-devel

  • エラー
configure: error: Your t1lib distribution is not installed correctly. Please reinstall it.
  • t1lib
yum install -y t1lib

  • エラー
configure: error: Unable to locate gmp.h
  • gmp
yum install -y gmp-devel

  • エラー
configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing. This should not happen. Check config.log for additional information.
  • libc-client
yum install -y libc-client-devel

参考: U8T_CANONICAL is missing.


  • エラー
configure: error: libgds, libib_util or libfbclient not found! Check config.log for more information.
  • freebird
yum install firebird-devel

  • エラー
configure: error: Unable to detect ICU prefix or /usr/bin/icu-config failed. Please verify ICU install prefix and make sure icu-config works.
  • libicu
yum install libicu-devel

  • エラー
configure: error: ICU version 4.0 or later is required

yumでインストールできるicuのバージョンが古いのでソースからインストールする

  • libicu(source)
wget http://download.icu-project.org/files/icu4c/51.2/icu4c-51_2-src.tgz
tar -zxvf icu4c-51_2-src.tgz
cd icu/source
./configure
make
make install
- --with-icu-dir=/usr
+ --with-icu-dir=/usr/local

  • エラー
configure: error: mcrypt.h not found. Please reinstall libmcrypt.
  • libmcrypt
yum install -y libmcrypt-devel

  • エラー
configure: error: Directory /usr is not a FreeTDS installation directory
  • freetds
yum install -y freetds-devel

ここからfreetds,mssqlに関してのエラーが出てきてしばらく取り組んだものの解決せず、心折れました

ここまでで既に数時間.....

そもそもテスト環境でconfigure option何も指定してないけどちゃんと動いてるって時点で本番でもオプション付ける必要ないよねって結論に至って単純に何もつけずにインストールしました

動作確認でも問題なかったです

どこかで誰かのお役に立てれば。。。