Linux

PHPのアップグレード

2005年11月1日

PHPに“最悪”のセキュリティ・ホールとの情報に従って、以下の通り、PHPを4.4.1にアップグレードした。

# tar xvzf php-4.4.1.tar.gz
# cd php-4.4.1
# ./configure '--prefix=/usr' '--with-apxs2=/usr/bin/apxs2' \
'--with-config-file-path=/etc/php4/apache2' '--enable-memory-limit' '--disable-debug' \
'--with-regex=php' '--disable-rpath' '--disable-static' \
'--with-pic' '--with-layout=GNU' '--with-pear=/usr/share/php' \
'--enable-calendar' '--enable-sysvsem' '--enable-sysvshm' \
'--enable-sysvmsg' '--enable-track-vars' '--enable-trans-sid' \
'--enable-bcmath' '--with-bz2' '--enable-ctype' \
'--with-db4' '--with-iconv' '--enable-exif' \
'--enable-filepro' '--enable-ftp' '--with-gettext' \
'--enable-mbstring' '--with-pcre-regex=/usr' '--enable-shmop' \
'--enable-sockets' '--enable-wddx' '--disable-xml' \
'--with-expat-dir=/usr' '--with-xmlrpc' '--enable-yp' '--with-zlib' \
'--without-pgsql' '--with-kerberos=/usr' '--with-openssl=/usr' \
'--with-zip=/usr' '--enable-dbx' '--with-mime-magic=/usr/share/misc/file/magic.mime' \
'--with-exec-dir=/usr/lib/php4/libexec' '--without-mm' '--without-sybase-ct'

Sorry, I cannot run apxs. Possible reasons follow:

1. Perl is not installed
2. apxs was not found. Try to pass the path using --with-apxs2=/path/to/apxs
3. Apache was not built using --enable-so (the apxs usage page is displayed)

# apt-get install apache2-dev

The following NEW packages will be installed:
apache2-threaded-dev autoconf autotools-dev bzip2 libapr0-dev libdb4.2-dev
libexpat1-dev libldap2-dev libpcre3-dev libssl-dev libtool zlib1g-dev

# ./configure '--prefix=/usr'...(略)

checking for BZip2 in default path... not found
configure: error: Please reinstall the BZip2 distribution

# apt-get install libbz2-dev

The following NEW packages will be installed:
libbz2-dev

# ./configure '--prefix=/usr'...(略)

configure: error: Cannot find libzzip

# apt-get install libzzip-dev

The following NEW packages will be installed:
libzzip-dev

# ./configure '--prefix=/usr'...(略)

Generating files
updating cache ./config.cache
creating ./config.status
creating php4.spec
creating main/build-defs.h
creating scripts/phpize
creating scripts/man1/phpize.1
creating scripts/php-config
creating scripts/man1/php-config.1
creating sapi/cli/php.1
creating main/php_config.h
creating main/internal_functions.c
creating main/internal_functions_cli.c
+--------------------------------------------------------------------+
| License: |
| This software is subject to the PHP License, available in this |
| distribution in the file LICENSE. By continuing this installation |
| process, you are bound by the terms of this license agreement. |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point. |
+--------------------------------------------------------------------+
| *** NOTE *** |
| The default for register_globals is now OFF! |
| |
| If your application relies on register_globals being ON, you |
| should explicitly set it to on in your php.ini file. |
| Note that you are strongly encouraged to read |
| http://www.php.net/manual/en/security.globals.php |
| about the implications of having register_globals set to on, and |
| avoid using it if possible. |
+--------------------------------------------------------------------+

Thank you for using PHP.

# make

Build complete.
(It is safe to ignore warnings about tempnam and tmpnam).

# make install

./configure のオプションは、旧バージョンのPHPのphpinfo()からコピーして、"--without-mysql"を削除して用いた。

2006-02-28 追記
 GDが使えなかったので、追加した。

# ./configure '--prefix=/usr' (略) '--with-gd'

checking for GD support... yes
checking for the location of libjpeg... no
checking for the location of libpng... no
checking for the location of libXpm... no
checking for FreeType 1.x support... no
checking for FreeType 2... no
checking for T1lib support... no
checking whether to enable truetype string function in GD... no
checking whether to enable JIS-mapped Japanese font support in GD... no
checking for fabsf... yes
checking for floorf... yes
If configure fails try --with-jpeg-dir=<DIR>
configure: error: libpng.(a|so) not found.

# apt-get install libjpeg62 libjpeg62-dev libpng3 libpng3-dev
# ./configure '--prefix=/usr' (略) '--with-gd' '--with-jpeg-dir=/user/lib'

Thank you for using PHP.

# make clean
# make

Build complete.
(It is safe to ignore warnings about tempnam and tmpnam).

# /etc/init.d/apache2 stop
# make install
# /etc/init.d/apache2 start

『make clean』を行うのが、ポイントのようである。

コメント

コメントはありません

コメント送信