PHP5.2 install

PHP5.2とPHP5.3へのバージョンアップ手順

△PHP5.2について

CentOS 5.3 などではPHP5.1が標準サポートなので、PHP5.2以上を使う場合は、さまざまサードパーティが作成したRPMパッケージとそのレポジトリを利活用するようになります。remi というレポジトリもそのひとつです。

remiレポジトリにあるPHPの全てのリスト表示

 # yum --enablerepo=remi list php-*

△PHP5.2から5.3へのバージョンアップ

環境:  CentOS 5.5 x86_64 Linux version 2.6.18-194.26.1.el5 ([email protected]) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-48))

PHP5.2の内容: 既にremiレポジトリのPHP5.2環境がインストール済み

# yum list installed php*

Loaded plugins: fastestmirror, priorities Loading mirror speeds from cached hostfile * addons: ftp.iij.ad.jp * base: ftp.iij.ad.jp * extras: ftp.iij.ad.jp * updates: ftp.iij.ad.jp Installed Packages php.x86_64 5.2.9-1.el5.remi installed php-cli.x86_64 5.2.9-1.el5.remi installed php-common.x86_64 5.2.9-1.el5.remi installed php-dba.x86_64 5.2.9-1.el5.remi installed php-devel.x86_64 5.2.9-1.el5.remi installed php-gd.x86_64 5.2.9-1.el5.remi installed php-ldap.x86_64 5.2.9-1.el5.remi installed php-mbstring.x86_64 5.2.9-1.el5.remi installed php-mysql.x86_64 5.2.9-1.el5.remi installed php-odbc.x86_64 5.2.9-1.el5.remi installed php-pdo.x86_64 5.2.9-1.el5.remi installed php-pear.noarch 1:1.8.1-1.el5.remi installed php-pear-db.noarch 1.7.13-2.el5.rf installed php-pgsql.x86_64 5.2.9-1.el5.remi installed php-soap.x86_64 5.2.9-1.el5.remi installed php-xml.x86_64 5.2.9-1.el5.remi installed

PHP 5.2 から5.3 へアップデートするには libedit.x86_64 が必要となるので、まず、libeditをインストールする。

# yum install libedit.x86_64 --enablerepo=epel

Loaded plugins: fastestmirror, priorities Loading mirror speeds from cached hostfile * addons: ftp.iij.ad.jp * base: ftp.iij.ad.jp * epel: ftp.yz.yamagata-u.ac.jp * extras: ftp.iij.ad.jp * updates: ftp.iij.ad.jp Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package libedit.x86_64 0:2.11-2.20080712cvs.el5 set to be updated --> Finished Dependency Resolution Dependencies Resolved ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: libedit x86_64 2.11-2.20080712cvs.el5 epel 80 k Transaction Summary ================================================================================ Install 1 Package(s) Upgrade 0 Package(s) Total download size: 80 k Is this ok [y/N]: y Downloading Packages: libedit-2.11-2.20080712cvs.el5.x86_64.rpm | 80 kB 00:00 Running rpm_check_debug Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction Installing : libedit 1/1 Installed: libedit.x86_64 0:2.11-2.20080712cvs.el5 Complete!

PHP5.3へのアップデート:

# yum --enablerepo=remi update php-\* Loaded plugins: fastestmirror, priorities Loading mirror speeds from cached hostfile * addons: ftp.iij.ad.jp * base: ftp.iij.ad.jp * extras: ftp.iij.ad.jp * remi: rpms.famillecollet.com * updates: ftp.iij.ad.jp Setting up Update Process Resolving Dependencies --> Running transaction check ---> Package php.x86_64 0:5.3.4-1.el5.remi set to be updated ---> Package php-cli.x86_64 0:5.3.4-1.el5.remi set to be updated ---> Package php-common.x86_64 0:5.3.4-1.el5.remi set to be updated ---> Package php-dba.x86_64 0:5.3.4-1.el5.remi set to be updated ---> Package php-devel.x86_64 0:5.3.4-1.el5.remi set to be updated ---> Package php-gd.x86_64 0:5.3.4-1.el5.remi set to be updated ---> Package php-ldap.x86_64 0:5.3.4-1.el5.remi set to be updated ---> Package php-mbstring.x86_64 0:5.3.4-1.el5.remi set to be updated ---> Package php-mysql.x86_64 0:5.3.4-1.el5.remi set to be updated ---> Package php-odbc.x86_64 0:5.3.4-1.el5.remi set to be updated ---> Package php-pdo.x86_64 0:5.3.4-1.el5.remi set to be updated ---> Package php-pgsql.x86_64 0:5.3.4-1.el5.remi set to be updated ---> Package php-soap.x86_64 0:5.3.4-1.el5.remi set to be updated ---> Package php-xml.x86_64 0:5.3.4-1.el5.remi set to be updated --> Finished Dependency Resolution Dependencies Resolved ================================================================================ Package Arch Version Repository Size ================================================================================ Updating: php x86_64 5.3.4-1.el5.remi remi 1.4 M php-cli x86_64 5.3.4-1.el5.remi remi 2.6 M php-common x86_64 5.3.4-1.el5.remi remi 968 k php-dba x86_64 5.3.4-1.el5.remi remi 59 k php-devel x86_64 5.3.4-1.el5.remi remi 622 k php-gd x86_64 5.3.4-1.el5.remi remi 204 k php-ldap x86_64 5.3.4-1.el5.remi remi 54 k php-mbstring x86_64 5.3.4-1.el5.remi remi 2.3 M php-mysql x86_64 5.3.4-1.el5.remi remi 157 k php-odbc x86_64 5.3.4-1.el5.remi remi 86 k php-pdo x86_64 5.3.4-1.el5.remi remi 116 k php-pgsql x86_64 5.3.4-1.el5.remi remi 132 k php-soap x86_64 5.3.4-1.el5.remi remi 275 k php-xml x86_64 5.3.4-1.el5.remi remi 220 k Transaction Summary ================================================================================ Install 0 Package(s) Upgrade 14 Package(s) Total download size: 9.1 M

Is this ok [y/N]: y

Downloading Packages: (1/14): php-ldap-5.3.4-1.el5.remi.x86_64.rpm | 54 kB 00:00 (2/14): php-dba-5.3.4-1.el5.remi.x86_64.rpm | 59 kB 00:00 (3/14): php-odbc-5.3.4-1.el5.remi.x86_64.rpm | 86 kB 00:01 (4/14): php-pdo-5.3.4-1.el5.remi.x86_64.rpm | 116 kB 00:01 (5/14): php-pgsql-5.3.4-1.el5.remi.x86_64.rpm | 132 kB 00:01 (6/14): php-mysql-5.3.4-1.el5.remi.x86_64.rpm | 157 kB 00:01 (7/14): php-gd-5.3.4-1.el5.remi.x86_64.rpm | 204 kB 00:01 (8/14): php-xml-5.3.4-1.el5.remi.x86_64.rpm | 220 kB 00:01 (9/14): php-soap-5.3.4-1.el5.remi.x86_64.rpm | 275 kB 00:01 (10/14): php-devel-5.3.4-1.el5.remi.x86_64.rpm | 622 kB 00:02 (11/14): php-common-5.3.4-1.el5.remi.x86_64.rpm | 968 kB 00:02 (12/14): php-5.3.4-1.el5.remi.x86_64.rpm | 1.4 MB 00:03 (13/14): php-mbstring-5.3.4-1.el5.remi.x86_64.rpm | 2.3 MB 00:04 (14/14): php-cli-5.3.4-1.el5.remi.x86_64.rpm | 2.6 MB 00:04 --------------------------------------------------------------------------------

Total 245 kB/s |

9.1 MB 00:37 Running rpm_check_debug Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction WARNING : This php-* RPM are not official Fedora/Redhat build and overrides the official ones. Don't file bugs on Fedora Project nor Redhat. Use dedicated forums http://forums.famillecollet.com/ Updating : php-common 1/28 Updating : php-pdo 2/28 Updating : php-cli 3/28 Updating : php 4/28 Updating : php-devel 5/28 Updating : php-dba 6/28 Updating : php-mysql 7/28 Updating : php-xml 8/28 Updating : php-soap 9/28 Updating : php-pgsql 10/28 Updating : php-odbc 11/28 Updating : php-ldap 12/28 Updating : php-gd 13/28 Updating : php-mbstring 14/28 Cleanup : php-cli 15/28 Cleanup : php-devel 16/28 Cleanup : php-dba 17/28 Cleanup : php-common 18/28 Cleanup : php-mysql 19/28 Cleanup : php-xml 20/28 Cleanup : php-soap 21/28 Cleanup : php 22/28 Cleanup : php-pgsql 23/28 Cleanup : php-odbc 24/28 Cleanup : php-ldap 25/28 Cleanup : php-gd 26/28 Cleanup : php-pdo 27/28 Cleanup : php-mbstring 28/28 Updated: php.x86_64 0:5.3.4-1.el5.remi php-cli.x86_64 0:5.3.4-1.el5.remi php-common.x86_64 0:5.3.4-1.el5.remi php-dba.x86_64 0:5.3.4-1.el5.remi php-devel.x86_64 0:5.3.4-1.el5.remi php-gd.x86_64 0:5.3.4-1.el5.remi php-ldap.x86_64 0:5.3.4-1.el5.remi php-mbstring.x86_64 0:5.3.4-1.el5.remi php-mysql.x86_64 0:5.3.4-1.el5.remi php-odbc.x86_64 0:5.3.4-1.el5.remi php-pdo.x86_64 0:5.3.4-1.el5.remi php-pgsql.x86_64 0:5.3.4-1.el5.remi php-soap.x86_64 0:5.3.4-1.el5.remi php-xml.x86_64 0:5.3.4-1.el5.remi Complete!

 

△ MySQLのアップデイト

念のためにMySQLも既に導入済みのremiレポジトリからアップデイト:

アップデイト前の環境

# yum list installed mysql*

Loaded plugins: fastestmirror, priorities Loading mirror speeds from cached hostfile * addons: ftp.iij.ad.jp * base: ftp.iij.ad.jp * extras: ftp.iij.ad.jp * updates: ftp.iij.ad.jp Installed Packages mysql.x86_64 5.1.34-1.el5.remi installed mysql-connector-odbc.x86_64 3.51.26r1127-1.el5 installed mysql-devel.x86_64 5.1.34-1.el5.remi installed mysql-libs.x86_64 5.1.34-1.el5.remi installed mysql-server.x86_64 5.1.34-1.el5.remi installed mysqlclient15.x86_64 5.0.67-1.el5.remi installed

アップデイトの実行

# yum --enablerepo=remi update mysql-\*

Loaded plugins: fastestmirror, priorities Loading mirror speeds from cached hostfile * addons: ftp.iij.ad.jp * base: ftp.iij.ad.jp * extras: ftp.iij.ad.jp * remi: iut-info.univ-reims.fr * updates: ftp.iij.ad.jp Setting up Update Process Resolving Dependencies --> Running transaction check ---> Package mysql.x86_64 0:5.1.54-1.el5.remi set to be updated ---> Package mysql-devel.x86_64 0:5.1.54-1.el5.remi set to be updated ---> Package mysql-libs.x86_64 0:5.1.54-1.el5.remi set to be updated ---> Package mysql-server.x86_64 0:5.1.54-1.el5.remi set to be updated --> Finished Dependency Resolution Dependencies Resolved ================================================================================ Package Arch Version Repository Size ================================================================================ Updating: mysql x86_64 5.1.54-1.el5.remi remi 1.1 M mysql-devel x86_64 5.1.54-1.el5.remi remi 121 k mysql-libs x86_64 5.1.54-1.el5.remi remi 1.7 M mysql-server x86_64 5.1.54-1.el5.remi remi 11 M Transaction Summary ================================================================================ Install 0 Package(s) Upgrade 4 Package(s) Total download size: 14 M Is this ok [y/N]: y Downloading Packages: (1/4): mysql-devel-5.1.54-1.el5.remi.x86_64.rpm | 121 kB 00:01 (2/4): mysql-5.1.54-1.el5.remi.x86_64.rpm | 1.1 MB 00:03 (3/4): mysql-libs-5.1.54-1.el5.remi.x86_64.rpm | 1.7 MB 00:05 (4/4): mysql-server-5.1.54-1.el5.remi.x86_64.rpm | 11 MB 00:27 -------------------------------------------------------------------------------- Total 348 kB/s | 14 MB 00:39

Running rpm_check_debug Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction WARNING : This MySQL RPM is not an official Fedora/Redhat build and it overrides the official one. Don't file bugs on Fedora Project nor Redhat. Use dedicated forums http://forums.famillecollet.com/ Updating : mysql-libs 1/8 Updating : mysql 2/8 Updating : mysql-devel 3/8 Updating : mysql-server 4/8 Cleanup : mysql-devel 5/8 Cleanup : mysql-libs 6/8 Cleanup : mysql-server 7/8 Cleanup : mysql 8/8 Updated: mysql.x86_64 0:5.1.54-1.el5.remi mysql-devel.x86_64 0:5.1.54-1.el5.remi mysql-libs.x86_64 0:5.1.54-1.el5.remi mysql-server.x86_64 0:5.1.54-1.el5.remi Complete!

以上でPHP5.3とMySQL5.1.54-1が使えるようになりました。

apacheとMySQLの再起動。

# /etc/init.d/httpd restart

# /etc/init.d/mysqld restart

PHPのバージョン確認:

# php -v

PHP 5.3.4 (cli) (built: Dec 11 2010 18:28:50) Copyright (c) 1997-2010 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

MySQLのバージョン確認:

# mysql

Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.1.54 MySQL Community Server (GPL) by Remi Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. This software comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to modify and redistribute it under the GPL v2 license Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

 

△ PHP Suhosin のインストール

オプションとして、PHP言語のCMSによっては、セキュリティ向上のために suhosin パッケージを必要とする場合があるので、 remi レポジトリからインストールします。

# yum install php-suhosin-0.9.32.1-1.el5.remi.x86_64 --enablerepo=remi

Loaded plugins: fastestmirror, priorities Loading mirror speeds from cached hostfile * addons: ftp.iij.ad.jp * base: ftp.iij.ad.jp * extras: ftp.iij.ad.jp * remi: rpms.famillecollet.com * updates: ftp.iij.ad.jp Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package php-suhosin.x86_64 0:0.9.32.1-1.el5.remi set to be updated --> Finished Dependency Resolution Dependencies Resolved ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: php-suhosin x86_64 0.9.32.1-1.el5.remi remi 78 k Transaction Summary ================================================================================ Install 1 Package(s) Upgrade 0 Package(s) Total download size: 78 k Is this ok [y/N]: y Downloading Packages: php-suhosin-0.9.32.1-1.el5.remi.x86_64.rpm | 78 kB 00:01 Running rpm_check_debug Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction Installing : php-suhosin 1/1 Installed: php-suhosin.x86_64 0:0.9.32.1-1.el5.remi Complete! # php -v PHP 5.3.4 (cli) (built: Dec 11 2010 18:28:50) Copyright (c) 1997-2010 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies with Suhosin v0.9.32.1, Copyright (c) 2007-2010, by SektionEins GmbH

※参考までに、Suhosinの開発元サイトには、Gentoo Linux FreeBSD OpenSuSE Madriva Debian などではRPMが用意されているようです。以下のサイトをご覧下さい。 http://www.hardened-php.net/suhosin/download.html