PHP5.2xインストール

WordPressのplugin quick-cacheをインストールしたところ、PHP5.2へバージョンアップしろと言い出した為、
PHP5.1 → 5.2へバージョンアップをする事にしました。
現在のyumでは5.1までしか入らないようですので、新たにリポジトリを追加して5.2をインストールします。
なお、こちらを参考にさせて頂きました。

最初にPHPのバージョンを確認します。

[root@centos]# php -v
PHP 5.1.6 (cli) (built: Nov 29 2010 16:47:46)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
[root@centos]# yum list installed | grep php*
php.x86_64                                5.1.6-27.el5_5.3             installed
php-cli.x86_64                            5.1.6-27.el5_5.3             installed
php-common.x86_64                         5.1.6-27.el5_5.3             installed
php-mbstring.x86_64                       5.1.6-27.el5_5.3             installed
php-mcrypt.x86_64                         5.1.6-15.el5.centos.1        installed
php-mysql.x86_64                          5.1.6-27.el5_5.3             installed
php-pdo.x86_64                            5.1.6-27.el5_5.3             installed

続いて、リポジトリを追加します。

[root@centos]# vi /etc/yum.repos.d/utterramblings.repo
[utterramblings]
name=Jason's Utter Ramblings Repo
baseurl=http://www.jasonlitka.com/media/EL$releasever/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka
priority=0

updateします。

[root@centos]# yum -y update php
Loaded plugins: downloadonly, fastestmirror, priorities
Loading mirror speeds from cached hostfile
 * addons: ftp.nara.wide.ad.jp
 * base: ftp.nara.wide.ad.jp
 * epel: ftp.jaist.ac.jp
 * extras: ftp.nara.wide.ad.jp
 * remi: rpms.famillecollet.com
 * rpmforge: fr2.rpmfind.net
 * updates: ftp.nara.wide.ad.jp
Reducing CentOS-5 Testing to included packages only
Finished
548 packages excluded due to repository priority protections
Setting up Update Process
Resolving Dependencies
--> Running transaction check
---> Package php.x86_64 0:5.2.16-jason.1 set to be updated
--> Processing Dependency: php-common = 5.2.16-jason.1 for package: php
--> Processing Dependency: php-cli = 5.2.16-jason.1 for package: php
--> Running transaction check
---> Package php-cli.x86_64 0:5.2.16-jason.1 set to be updated
--> Processing Dependency: php-common = 5.1.6-27.el5_5.3 for package: php-pdo
--> Processing Dependency: php-common = 5.1.6-27.el5_5.3 for package: php-mbstring
--> Processing Dependency: php-common = 5.1.6-27.el5_5.3 for package: php-mysql
---> Package php-common.x86_64 0:5.2.16-jason.1 set to be updated
--> Running transaction check
---> Package php-mbstring.x86_64 0:5.2.16-jason.1 set to be updated
---> Package php-mysql.x86_64 0:5.2.16-jason.1 set to be updated
--> Processing Dependency: libmysqlclient.so.16(libmysqlclient_16)(64bit) for package: php-mysql
--> Processing Dependency: libmysqlclient.so.16()(64bit) for package: php-mysql
---> Package php-pdo.x86_64 0:5.2.16-jason.1 set to be updated
--> Running transaction check
--> Processing Dependency: libmysqlclient.so.15()(64bit) for package: mysql-server
--> Processing Dependency: libmysqlclient.so.15()(64bit) for package: perl-DBD-MySQL
--> Processing Dependency: libmysqlclient.so.15(libmysqlclient_15)(64bit) for package: mysql-server
--> Processing Dependency: libmysqlclient.so.15(libmysqlclient_15)(64bit) for package: perl-DBD-MySQL
--> Processing Dependency: libmysqlclient_r.so.15()(64bit) for package: mysql-server
--> Processing Dependency: libmysqlclient_r.so.15(libmysqlclient_15)(64bit) for package: mysql-server
--> Processing Dependency: mysql = 5.0.77-4.el5_5.4 for package: mysql-server
---> Package mysql.x86_64 0:5.1.52-jason.1 set to be updated
--> Running transaction check
---> Package mysql-server.x86_64 0:5.1.52-jason.1 set to be updated
---> Package mysqlclient15.x86_64 0:5.0.91-1.jason.1 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================================
 Package              Arch          Version                 Repository             Size
========================================================================================
Updating:
 php                  x86_64        5.2.16-jason.1          utterramblings        3.8 M
Installing for dependencies:
 mysqlclient15        x86_64        5.0.91-1.jason.1        utterramblings        2.0 M
Updating for dependencies:
 mysql                x86_64        5.1.52-jason.1          utterramblings        3.5 M
 mysql-server         x86_64        5.1.52-jason.1          utterramblings         13 M
 php-cli              x86_64        5.2.16-jason.1          utterramblings        2.6 M
 php-common           x86_64        5.2.16-jason.1          utterramblings        522 k
 php-mbstring         x86_64        5.2.16-jason.1          utterramblings        1.4 M
 php-mysql            x86_64        5.2.16-jason.1          utterramblings        280 k
 php-pdo              x86_64        5.2.16-jason.1          utterramblings        169 k

Transaction Summary
========================================================================================
Install       1 Package(s)
Upgrade       8 Package(s)

Total size: 27 M
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Updating       : php-common                                                      1/17
  Installing     : mysqlclient15                                                   2/17
  Updating       : php-pdo                                                         3/17
  Updating       : mysql                                                           4/17
  Updating       : php-cli                                                         5/17
  Updating       : php-mysql                                                       6/17
  Updating       : php                                                             7/17

 ******************************************************************************
 * If this is a new installation you should run 'mysql_secure_installation'.  *
 *                                                                            *
 * If you are upgrading from a previous version of MySQL you should run the   *
 * 'mysql_upgrade' script to check your tables and update them to the newest  *
 * format. This command may take a long time to run if you have large tables. *
 ******************************************************************************

  Updating       : mysql-server                                                    8/17
  Updating       : php-mbstring                                                    9/17
  Cleanup        : php-common                                                     10/17
  Cleanup        : php-mysql                                                      11/17
  Cleanup        : php                                                            12/17
  Cleanup        : php-pdo                                                        13/17
  Cleanup        : php-cli                                                        14/17
  Cleanup        : mysql                                                          15/17
  Cleanup        : mysql-server                                                   16/17
  Cleanup        : php-mbstring                                                   17/17

Dependency Installed:
  mysqlclient15.x86_64 0:5.0.91-1.jason.1

Updated:
  php.x86_64 0:5.2.16-jason.1

Dependency Updated:
  mysql.x86_64 0:5.1.52-jason.1              mysql-server.x86_64 0:5.1.52-jason.1
  php-cli.x86_64 0:5.2.16-jason.1            php-common.x86_64 0:5.2.16-jason.1
  php-mbstring.x86_64 0:5.2.16-jason.1       php-mysql.x86_64 0:5.2.16-jason.1
  php-pdo.x86_64 0:5.2.16-jason.1

Complete!

インストール出来たので、確認します。

[root@centos]# php -v
PHP Warning:  PHP Startup: mcrypt: Unable to initialize module
Module compiled with module API=20050922, debug=0, thread-safety=0
PHP    compiled with module API=20060613, debug=0, thread-safety=0
These options need to match
 in Unknown on line 0
PHP 5.2.16 (cli) (built: Dec 17 2010 14:11:16)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies

PHP自体は5.2になっていますが、Warningが出ていました。
php-mcryptが5.1のままでしたので、明示してupdateします。

[root@centos]# yum list installed | grep php*
php.x86_64                                5.2.16-jason.1               installed
php-cli.x86_64                            5.2.16-jason.1               installed
php-common.x86_64                         5.2.16-jason.1               installed
php-mbstring.x86_64                       5.2.16-jason.1               installed
php-mcrypt.x86_64                         5.1.6-15.el5.centos.1        installed
php-mysql.x86_64                          5.2.16-jason.1               installed
php-pdo.x86_64                            5.2.16-jason.1               installed

[root@centos]# yum update php-mcrypt
Loaded plugins: downloadonly, fastestmirror, priorities
Loading mirror speeds from cached hostfile
 * addons: ftp.nara.wide.ad.jp
 * base: ftp.nara.wide.ad.jp
 * epel: ftp.jaist.ac.jp
 * extras: ftp.nara.wide.ad.jp
 * remi: rpms.famillecollet.com
 * rpmforge: fr2.rpmfind.net
 * updates: ftp.nara.wide.ad.jp
Reducing CentOS-5 Testing to included packages only
Finished
548 packages excluded due to repository priority protections
Setting up Update Process
Resolving Dependencies
--> Running transaction check
---> Package php-mcrypt.x86_64 0:5.2.16-jason.1 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================================
 Package            Arch           Version                 Repository              Size
========================================================================================
Updating:
 php-mcrypt         x86_64         5.2.16-jason.1          utterramblings          50 k

Transaction Summary
========================================================================================
Install       0 Package(s)
Upgrade       1 Package(s)

Total download size: 50 k
Is this ok [y/N]: y
Downloading Packages:
php-mcrypt-5.2.16-jason.1.x86_64.rpm                             |  50 kB     00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Updating       : php-mcrypt                                                       1/2
  Cleanup        : php-mcrypt                                                       2/2

Updated:
  php-mcrypt.x86_64 0:5.2.16-jason.1

Complete!

忘れずに最初追加したリポジトリを無効化(enabled=0)しておきます。

[root@centos]# vi /etc/yum.repos.d/utterramblings.repo
[utterramblings]
name=Jason’s Utter Ramblings Repo
baseurl=http://www.jasonlitka.com/media/EL$releasever/$basearch/
enabled=0
gpgcheck=1
gpgkey=http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka
priority=0

apache restart

[root@centos]# service httpd restart
httpd を停止中:                                            [  OK  ]
httpd を起動中:                                            [  OK  ]

ブラウザから確認してみると表示されなかった為、apacheのエラーログを確認すると
メモリサイズがオーバーしているようなので、今回は手っ取り早く割り当てを増やしました。

[root@centos]# tail -f /etc/httpd/logs/error_log
PHP Fatal error:  Allowed memory size of 33554432 bytes exhausted.........
[root@centos]# vi /etc/php.ini
...
memory_limit = 48M
...

最後にもう一度apacheをrestartすれば完了です。

さくらVPS借りてみました

2ヶ月程前からさくらVPSのホスティング環境を借りていたのですが、
しばらく放置していたので、少しイジリ始めました。

環境構築時は色々なサイトを参考にさせてもらいつつも、ちょっとしたこと事で止まってしまい調べたり、、
そもそも自分でドメインさえも取得した事がなかったので、何事も経験ですね。
現状はひと通りのモノは入れ終わり、ある程度は動くようになっています。

普段、ERP等のパッケージソフトに携わっているとこのあたりがうとくなりがちなので、
これからこの環境で少しずつ検証していきます。