CentOS5にインストールされるPHPのバージョンは5.1.6なのですが、WordpressやCakePHP2とかがもう動かないことになってしまっています。テスト環境の評価機なのですが、なにせ機種が古くて、最新のCentOS6はスペックがもう合わないことになってました。とりあえずPHP5.3にすることが出来ればもうしばらく役たってくれそうなのでちょっと頑張って見ることにします。
PHPのバージョンを確認
# php -v PHP 5.1.6 (cli) (built: Jan 21 2009 01:40:08) Copyright (c) 1997-2006 The PHP Group Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
#PHPのインストールパッケージを確認
# yum list installed | grep "php" php.i386 5.1.6-23.el5 installed php-cli.i386 5.1.6-23.el5 installed php-common.i386 5.1.6-23.el5 installed php-devel.i386 5.1.6-23.el5 installed php-gd.i386 5.1.6-23.el5 installed php-ldap.i386 5.1.6-23.el5 installed php-mbstring.i386 5.1.6-23.el5 installed php-mcrypt.i386 5.1.6-15.el5.centos.1 installed php-mysql.i386 5.1.6-23.el5 installed php-odbc.i386 5.1.6-23.el5 installed php-pdo.i386 5.1.6-23.el5 installed php-pear.noarch 1:1.4.9-4.el5.1 installed php-xml.i386 5.1.6-23.el5 installed
#MySQLのバージョンを確認
mysql --version mysql Ver 14.12 Distrib 5.0.45, for redhat-linux-gnu (i686) using readline 5.0
#MySQLのインストールパッケージを確認
yum list installed | grep "mysql" libdbi-dbd-mysql.i386 0.8.1a-1.2.2 installed mysql.i386 5.0.45-7.el5 installed mysql-connector-odbc.i386 3.51.12-2.2 installed mysql-server.i386 5.0.45-7.el5 installed php-mysql.i386 5.1.6-23.el5 installed
今回はこんな感じでした。う~んmysqlはどうしようかな。
PHP5.1.6をアンインストール
依存関係にいろいろと問題あるよと。先人の偉い人達が仰せなので、アンインストールします。PHPが利用されているサービスである、appach と mysql を止めます。
/etc/rc.d/init.d/httpd stop /etc/init.d/mysqld stop
yum list installed | grep “php”で見つけたみんなをアンインストールします。
yum remove php.i386 php-cli.i386 php-common.i386 php-devel.i386 php-gd.i386 php-ldap.i386 php-mbstring.i386 php-mcrypt.i386 php-mysql.i386 php-odbc.i386 php-pdo.i386 php-pear.noarch php-xml.i386 Loaded plugins: fastestmirror Setting up Remove Process Resolving Dependencies --> Running transaction check ---> Package php-mbstring.i386 0:5.1.6-23.el5 set to be erased ---> Package php-mcrypt.i386 0:5.1.6-15.el5.centos.1 set to be erased ---> Package php-common.i386 0:5.1.6-23.el5 set to be erased ---> Package php-odbc.i386 0:5.1.6-23.el5 set to be erased ---> Package php-gd.i386 0:5.1.6-23.el5 set to be erased ---> Package php-devel.i386 0:5.1.6-23.el5 set to be erased ---> Package php-cli.i386 0:5.1.6-23.el5 set to be erased ---> Package php-ldap.i386 0:5.1.6-23.el5 set to be erased ---> Package php.i386 0:5.1.6-23.el5 set to be erased ---> Package php-mysql.i386 0:5.1.6-23.el5 set to be erased ---> Package php-pdo.i386 0:5.1.6-23.el5 set to be erased ---> Package php-pear.noarch 1:1.4.9-4.el5.1 set to be erased ---> Package php-xml.i386 0:5.1.6-23.el5 set to be erased --> Finished Dependency Resolution Dependencies Resolved ================================================================================ Package Arch Version Repository Size ================================================================================ Removing: php i386 5.1.6-23.el5 installed 2.9 M php-cli i386 5.1.6-23.el5 installed 5.2 M php-common i386 5.1.6-23.el5 installed 393 k php-devel i386 5.1.6-23.el5 installed 2.5 M php-gd i386 5.1.6-23.el5 installed 327 k php-ldap i386 5.1.6-23.el5 installed 43 k php-mbstring i386 5.1.6-23.el5 installed 1.6 M php-mcrypt i386 5.1.6-15.el5.centos.1 installed 32 k php-mysql i386 5.1.6-23.el5 installed 175 k php-odbc i386 5.1.6-23.el5 installed 83 k php-pdo i386 5.1.6-23.el5 installed 100 k php-pear noarch 1:1.4.9-4.el5.1 installed 1.8 M php-xml i386 5.1.6-23.el5 installed 215 k Transaction Summary ================================================================================ Install 0 Package(s) Update 0 Package(s) Remove 13 Package(s) Is this ok [y/N]: y Downloading Packages: Running rpm_check_debug Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction Erasing : php-cli [ 1/13] Erasing : php-mysql [ 2/13] Erasing : php-pear [ 3/13] Erasing : php-ldap [ 4/13] Erasing : php-xml [ 5/13] Erasing : php-pdo [ 6/13] Erasing : php-devel [ 7/13] Erasing : php [ 8/13] Erasing : php-odbc [ 9/13] Erasing : php-gd [10/13] Erasing : php-mbstring [11/13] Erasing : php-common [12/13] /etc/php.ini /etc/php.ini.rpmsave Erasing : php-mcrypt [13/13] Removed: php.i386 0:5.1.6-23.el5 php-cli.i386 0:5.1.6-23.el5 php-common.i386 0:5.1.6-23.el5 php-devel.i386 0:5.1.6-23.el5 php-gd.i386 0:5.1.6-23.el5 php-ldap.i386 0:5.1.6-23.el5 php-mbstring.i386 0:5.1.6-23.el5 php-mcrypt.i386 0:5.1.6-15.el5.centos.1 php-mysql.i386 0:5.1.6-23.el5 php-odbc.i386 0:5.1.6-23.el5 php-pdo.i386 0:5.1.6-23.el5 php-pear.noarch 1:1.4.9-4.el5.1 php-xml.i386 0:5.1.6-23.el5 Complete!
PHP5.3をインストール
yum list installed | grep “php”で見つけたみんなをphp53としてインストールします。
yum install php53.i386 php53-cli.i386 php53-common.i386 php53-devel.i386 php53-gd.i386 php53-ldap.i386 php53-mbstring.i386 php53-mcrypt.i386 php53-mysql.i386 php53-odbc.i386 php53-pdo.i386 php53-pear.noarch php53-xml.i386 Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: ftp.iij.ad.jp * updates: ftp.iij.ad.jp * addons: ftp.iij.ad.jp * extras: ftp.iij.ad.jp Setting up Install Process Parsing package install arguments No package php53-mcrypt.i386 available. No package php53-pear.noarch available. Resolving Dependencies --> Running transaction check ---> Package php53-mysql.i386 0:5.3.3-13.el5_8 set to be updated ---> Package php53-gd.i386 0:5.3.3-13.el5_8 set to be updated ---> Package php53-odbc.i386 0:5.3.3-13.el5_8 set to be updated ---> Package php53-cli.i386 0:5.3.3-13.el5_8 set to be updated ---> Package php53.i386 0:5.3.3-13.el5_8 set to be updated ---> Package php53-common.i386 0:5.3.3-13.el5_8 set to be updated ---> Package php53-ldap.i386 0:5.3.3-13.el5_8 set to be updated ---> Package php53-xml.i386 0:5.3.3-13.el5_8 set to be updated ---> Package php53-pdo.i386 0:5.3.3-13.el5_8 set to be updated ---> Package php53-mbstring.i386 0:5.3.3-13.el5_8 set to be updated ---> Package php53-devel.i386 0:5.3.3-13.el5_8 set to be updated --> Finished Dependency Resolution Dependencies Resolved ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: php53 i386 5.3.3-13.el5_8 base 1.3 M php53-cli i386 5.3.3-13.el5_8 base 2.5 M php53-common i386 5.3.3-13.el5_8 base 605 k php53-devel i386 5.3.3-13.el5_8 base 592 k php53-gd i386 5.3.3-13.el5_8 base 109 k php53-ldap i386 5.3.3-13.el5_8 base 36 k php53-mbstring i386 5.3.3-13.el5_8 base 1.2 M php53-mysql i386 5.3.3-13.el5_8 base 88 k php53-odbc i386 5.3.3-13.el5_8 base 52 k php53-pdo i386 5.3.3-13.el5_8 base 67 k php53-xml i386 5.3.3-13.el5_8 base 113 k Transaction Summary ================================================================================ Install 11 Package(s) Update 0 Package(s) Remove 0 Package(s) Total download size: 6.5 M Is this ok [y/N]: y Downloading Packages: (1/11): php53-ldap-5.3.3-13.el5_8.i386.rpm | 36 kB 00:00 (2/11): php53-odbc-5.3.3-13.el5_8.i386.rpm | 52 kB 00:00 (3/11): php53-pdo-5.3.3-13.el5_8.i386.rpm | 67 kB 00:00 (4/11): php53-mysql-5.3.3-13.el5_8.i386.rpm | 88 kB 00:00 (5/11): php53-gd-5.3.3-13.el5_8.i386.rpm | 109 kB 00:00 (6/11): php53-xml-5.3.3-13.el5_8.i386.rpm | 113 kB 00:00 (7/11): php53-devel-5.3.3-13.el5_8.i386.rpm | 592 kB 00:00 (8/11): php53-common-5.3.3-13.el5_8.i386.rpm | 605 kB 00:00 (9/11): php53-mbstring-5.3.3-13.el5_8.i386.rpm | 1.2 MB 00:00 (10/11): php53-5.3.3-13.el5_8.i386.rpm | 1.3 MB 00:00 (11/11): php53-cli-5.3.3-13.el5_8.i386.rpm | 2.5 MB 00:01 -------------------------------------------------------------------------------- Total 1.5 MB/s | 6.5 MB 00:04 Running rpm_check_debug Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction Installing : php53-common [ 1/11] Installing : php53-pdo [ 2/11] Installing : php53-cli [ 3/11] Installing : php53 [ 4/11] Installing : php53-ldap [ 5/11] Installing : php53-gd [ 6/11] Installing : php53-mysql [ 7/11] Installing : php53-odbc [ 8/11] Installing : php53-mbstring [ 9/11] Installing : php53-devel [10/11] Installing : php53-xml [11/11] Installed: php53.i386 0:5.3.3-13.el5_8 php53-cli.i386 0:5.3.3-13.el5_8 php53-common.i386 0:5.3.3-13.el5_8 php53-devel.i386 0:5.3.3-13.el5_8 php53-gd.i386 0:5.3.3-13.el5_8 php53-ldap.i386 0:5.3.3-13.el5_8 php53-mbstring.i386 0:5.3.3-13.el5_8 php53-mysql.i386 0:5.3.3-13.el5_8 php53-odbc.i386 0:5.3.3-13.el5_8 php53-pdo.i386 0:5.3.3-13.el5_8 php53-xml.i386 0:5.3.3-13.el5_8 Complete!
mcryptとpearをインストール
先のインストールを見てるとmcryptとpearがないことがわかります。
No package php53-mcrypt.i386 available. No package php53-pear.noarch available.
mcryptをインストール
こちらは、EPELのリポジトリから入れさせてもらいます。
rpm -ivh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm/var/tmp/rpm-xfer.P4DtyL: V3 DSA signature: NOKEY, key ID 217521f6 1:epel-release ########################################### [100%]404 Not Found
パッケージ名を確認
yum --enablerepo=epel list | grep php53-* php53.i386 5.3.3-13.el5_8 installed php53-cli.i386 5.3.3-13.el5_8 installed php53-common.i386 5.3.3-13.el5_8 installed php53-devel.i386 5.3.3-13.el5_8 installed php53-gd.i386 5.3.3-13.el5_8 installed php53-ldap.i386 5.3.3-13.el5_8 installed php53-mbstring.i386 5.3.3-13.el5_8 installed php53-mysql.i386 5.3.3-13.el5_8 installed php53-odbc.i386 5.3.3-13.el5_8 installed php53-pdo.i386 5.3.3-13.el5_8 installed php53-xml.i386 5.3.3-13.el5_8 installed php53-bcmath.i386 5.3.3-13.el5_8 base php53-dba.i386 5.3.3-13.el5_8 base php53-enchant.i386 5.3.3-1.el5 epel php53-imap.i386 5.3.3-13.el5_8 base php53-interbase.i386 5.3.3-1.el5 epel php53-intl.i386 5.3.3-13.el5_8 base php53-mapi.i386 7.0.12-1.el5 epel php53-mcrypt.i386 5.3.3-1.el5 epel php53-mssql.i386 5.3.3-1.el5 epel php53-odbc64.i386 5.3.3-2.el5 base php53-pgsql.i386 5.3.3-13.el5_8 base php53-php-gettext.noarch 1.0.11-3.el5 epel php53-process.i386 5.3.3-13.el5_8 base php53-pspell.i386 5.3.3-13.el5_8 base php53-recode.i386 5.3.3-1.el5 epel php53-snmp.i386 5.3.3-13.el5_8 base php53-soap.i386 5.3.3-13.el5_8 base php53-tidy.i386 5.3.3-1.el5 epel php53-xmlrpc.i386 5.3.3-13.el5_8 base
ありました!php53-mcrypt.i386ですね。
yum --enablerepo=epel install php53-mcrypt.i386 Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * epel: ftp.iij.ad.jp * base: ftp.iij.ad.jp * updates: ftp.iij.ad.jp * addons: ftp.iij.ad.jp * extras: ftp.iij.ad.jp Setting up Install Process Parsing package install arguments Resolving Dependencies --> Running transaction check ---> Package php53-mcrypt.i386 0:5.3.3-1.el5 set to be updated --> Finished Dependency Resolution Dependencies Resolved ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: php53-mcrypt i386 5.3.3-1.el5 epel 16 k Transaction Summary ================================================================================ Install 1 Package(s) Update 0 Package(s) Remove 0 Package(s) Total download size: 16 k Is this ok [y/N]: y Downloading Packages: php53-mcrypt-5.3.3-1.el5.i386.rpm | 16 kB 00:00 rpmts_HdrFromFdno: V3 DSA signature: NOKEY, key ID 217521f6 Importing GPG key 0x217521F6 "Fedora EPEL <epel@fedoraproject.org>" from /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL Is this ok [y/N]: y Running rpm_check_debug Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction Installing : php53-mcrypt [1/1] Installed: php53-mcrypt.i386 0:5.3.3-1.el5 Complete!
pearをインストール
こちらは、pearを再インストールしてpearコマンドでpearのバージョンを上げられるようです。
yum install php-pear Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * epel: ftp.iij.ad.jp * base: ftp.iij.ad.jp * updates: ftp.iij.ad.jp * addons: ftp.iij.ad.jp * extras: ftp.iij.ad.jp Setting up Install Process Parsing package install arguments Resolving Dependencies --> Running transaction check ---> Package php-pear.noarch 1:1.4.9-8.el5 set to be updated --> Finished Dependency Resolution Dependencies Resolved ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: php-pear noarch 1:1.4.9-8.el5 base 344 k Transaction Summary ================================================================================ Install 1 Package(s) Update 0 Package(s) Remove 0 Package(s) Total download size: 344 k Is this ok [y/N]: y Downloading Packages: php-pear-1.4.9-8.el5.noarch.rpm | 344 kB 00:00 Running rpm_check_debug Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction Installing : php-pear [1/1] Installed: php-pear.noarch 1:1.4.9-8.el5 Complete!
# pear upgrade --force Archive_Tar PHP Warning: PHP Startup: namazu: Unable to initialize module Module compiled with module API=20050922 PHP compiled with module API=20090626 These options need to match in Unknown on line 0 WARNING: channel "pear.php.net" has updated its protocols, use "channel-update pear.php.net" to update warning: pear/pear dependency package "pear/Archive_Tar" installed version 1.3.11 is not the recommended version 1.3.1 warning: pear/Archive_Tar requires PEAR Installer (version >= 1.5.4), installed version is 1.4.9 downloading Archive_Tar-1.3.11.tgz ... Starting to download Archive_Tar-1.3.11.tgz (18,537 bytes) ......done: 18,537 bytes upgrade ok: channel://pear.php.net/Archive_Tar-1.3.11 # pear upgrade --force Console_Getopt PHP Warning: PHP Startup: namazu: Unable to initialize module Module compiled with module API=20050922 PHP compiled with module API=20090626 These options need to match in Unknown on line 0 WARNING: channel "pear.php.net" has updated its protocols, use "channel-update pear.php.net" to update warning: pear/Console_Getopt requires PEAR Installer (version >= 1.8.0), installed version is 1.4.9 downloading Console_Getopt-1.3.1.tgz ... Starting to download Console_Getopt-1.3.1.tgz (4,471 bytes) .....done: 4,471 bytes upgrade ok: channel://pear.php.net/Console_Getopt-1.3.1 # pear upgrade PEAR PHP Warning: PHP Startup: namazu: Unable to initialize module Module compiled with module API=20050922 PHP compiled with module API=20090626 These options need to match in Unknown on line 0 WARNING: channel "pear.php.net" has updated its protocols, use "channel-update pear.php.net" to update downloading PEAR-1.9.4.tgz ... Starting to download PEAR-1.9.4.tgz (296,332 bytes) .............................................................done: 296,332 bytes upgrade ok: channel://pear.php.net/PEAR-1.9.4 PEAR: Optional feature webinstaller available (PEAR's web-based installer) PEAR: Optional feature gtkinstaller available (PEAR's PHP-GTK-based installer) PEAR: Optional feature gtk2installer available (PEAR's PHP-GTK2-based installer) To install use "pear install pear/PEAR#featurename"
で、インストール完了の様です。
リスト表示してみると。
yum list installed | grep "php" php-pear.noarch 1:1.4.9-8.el5 installed php53.i386 5.3.3-13.el5_8 installed php53-cli.i386 5.3.3-13.el5_8 installed php53-common.i386 5.3.3-13.el5_8 installed php53-devel.i386 5.3.3-13.el5_8 installed php53-gd.i386 5.3.3-13.el5_8 installed php53-ldap.i386 5.3.3-13.el5_8 installed php53-mbstring.i386 5.3.3-13.el5_8 installed php53-mcrypt.i386 5.3.3-1.el5 installed php53-mysql.i386 5.3.3-13.el5_8 installed php53-odbc.i386 5.3.3-13.el5_8 installed php53-pdo.i386 5.3.3-13.el5_8 installed php53-xml.i386 5.3.3-13.el5_8 installed
php.ini修正
php5.3はタイムゾーン設定が必修だということですので、php.iniを修正しておきます。
; Defines the default timezone used by the date functions ; http://www.php.net/manual/en/datetime.configuration.php#ini.date.timezone date.timezone = "Asia/Tokyo"
mysqlとapacheを起動
/etc/init.d/mysqld start /etc/rc.d/init.d/httpd start
お疲れ様でした。
コメント