CentOS(さくらのVPS)で、PHP5.3.3にアップデート

無名関数とか名前空間とか使いたいぞ

今日、パーフェクトPHP (PERFECT SERIES 3) を購入してみて、ぱらぱらとページをめくっていたら、急激にPHP5.3の機能を使ってコーディングしたくなりました。

PHP5.3.0へのRPMアップデート(CentOS5.3) | Yama's Memorandum

ここを参考に、前回 ( とあるさくらのVPS (5) 標準のCentOS 5.5で、PHPを5.1.6から5.2.xにする ) 5.2.4にアップデートしたPHPを、さらに5.3.3に引き上げます。

Remiというリポジトリが新しいバージョンのPHP等を提供しているみたい

上の日本語参考記事では、remi-testというリポジトリが参照されていましたが、今は普通にremiでOKです。

PHP 5.3.3 Released! - Les RPM de Remi - Blog

RPM of final release of php 5.3.3 are available for Fedora and for Enterprise Linux (RHEL/CentOS) in remi repository. This version will be available really soon in official updates (testing) for Fedora ≥ 12.

現在の最新を追ったら、2010/07/22付けでPHP5.3.3を使えるようになっているらしい。以下、Remiリポジトリの登録から、PHPのupdateまで。

1. まずはRemiのリポジトリを登録する

English : Repository Configuration - Les RPM de Remi - Blog

2.1. YUM automatic configuration. The simplest way is to install the remi-release package which provides the repository configuration for YUM and the GPG key used to sign the RPM.

ここに、リポジトリの登録方法がスニペットとして載っています。CentOSは、Enterprise Linux 5 (with EPEL)として見ればよさそうなので、参考にしながら下記のようにして登録。

% wget http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
% wget http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
% sudo rpm -Uvh remi-release-5*.rpm epel-release-5*.rpm
warning: remi-release-5.rpm: Header V4 DSA signature: NOKEY, key ID 00f97f56
warning: epel-release-5-4.noarch.rpm: Header V3 DSA signature: NOKEY, key ID 217521f6
Preparing...                ########################################### [100%]
   1:epel-release           ########################################### [ 50%]
   2:remi-release           ########################################### [100%]

Remiリポジトリがyumで参照できるようになりました。

2. Remiリポジトリを有効にしてphpをアップデート

依存関係だとかで厄介なことになったりしないかと、ドキドキしましたがさしたる問題もなく正常にアップデートされます。

% sudo yum --enablerepo=remi update php-\*
Dependency Installed:
  curl.i386 0:7.15.5-9.el5               libedit.x86_64 0:3.0-2.20090923cvs.el5.art     libidn.i386 0:0.6.5-1.1     libtool-ltdl.x86_64 0:1.5.22-7.el5_4     php-common.i386 0:5.2.14-2.el5.art     php-devel.x86_64 0:5.3.3-1.el5.remi    
  sqlite2.x86_64 0:2.8.17-2.el5.remi    

Updated:
  php.x86_64 0:5.3.3-1.el5.remi         php-cli.x86_64 0:5.3.3-1.el5.remi   php-common.x86_64 0:5.3.3-1.el5.remi   php-gd.x86_64 0:5.3.3-1.el5.remi         php-mbstring.x86_64 0:5.3.3-1.el5.remi   php-mcrypt.x86_64 0:5.3.3-1.el5.remi  
  php-mysql.x86_64 0:5.3.3-1.el5.remi   php-pdo.x86_64 0:5.3.3-1.el5.remi   php-pear.noarch 1:1.9.1-5.el5.remi     php-pecl-apc.x86_64 0:3.1.5-2.el5.remi   php-xml.x86_64 0:5.3.3-1.el5.remi
  
Complete!

ちょっと気になる点としては、yumがソースを集め回る際に、いくつかのサーバーで何かしらのエラーがでて、Trying other mirrorが繰り返されたりしました。5回とか6回くりかえすこともありましたが、放置しておいたらちゃんと全てダウンロードしてくれたので、同様の現象が再現した際も、待てばきっと大丈夫。

3. php.iniの設定を見直して終わり

/etc/php.ini.rpmnewの設定を編集して、/etc/php.iniとして保存しなおし、httpdをrestartして終わります。

It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier.

切り替え直後、上記のエラーが表示されまくって焦りましたが、date.timezone = Asia/Tokyoをphp.iniできちんと宣言したら表示されなくなりました。ほっ。


Author

ahomuAyumu Sato

overflow, Inc.VPoE

東京資本で生きる名古屋の鳥類

Web 技術、組織開発、趣味など雑多なブログ。技術の話題は zenn にも分散して投稿しています。

Bio: aho.mu
X: @ahomu
Zenn: ahomu
GitHub: ahomu

Related

Latest

Archives

Tags

Search