LoginSignup
4

More than 5 years have passed since last update.

PHP5.2→5.6へのアップデート手順

Posted at

タイトルの件を実行した手順メモ。
今の時代だと無さそうな環境です。
さすがに新たに環境作るならCentOSもPHPも7以上ですね。

環境

CentOS 5系
PHP 5.2.x

手順

現在入っているphp関連をメモして、リポジトリも追加します。

version確認
#rpm -qa | grep php
リポジトリ確認
#rpm -qa | grep epel
#rpm -qa | grep remi
存在する場合はそれを使用するか。削除して入れ直す。以下削除。
#rpm -e --test epel-release-xxx-xxx.noarch

#rpm -e epel-release-xxx-xxx.noarch
#rpm -e remi-release-xxx-xxx.elxxx.remi.noarch
リポジトリ取得(5系のもの)
#rpm -ivh http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
#rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm

リポジトリ追加が完了すると、/etc/yum.repos.d/以下にremi.repoとeple.repoという設定ファイルが生成されます。
この設定ファイル内で、デフォルトのインストールではRemiとEPELが無効になるように、「enabled=0」となっていることを確認します。

提供されているパッケージ確認
#yum list --enablerepo=remi-php56 |grep php

PHPのアンインストール+インストールを実施していきます。

php関連アンインストール
#yum remove php*
phpインストール
#yum install php php-common --enablerepo=remi-php56

怒られます。

error
php-common-5.6.30-1.el5.remi.i386 from remi-php56 has depsolving problems
  --> Missing Dependency: libcurl.so.4 is needed by package php-common-5.6.30-1.el5.remi.i386 (remi-php56)

libcurl.so.4 が存在しないようですのでインストールします。

#yum list --enablerepo=epel,remi,remi-php56 | grep libcurl
#yum --enablerepo=remi install libcurl

再度実行しますが怒られます。

error
php-cli-5.6.30-1.el5.remi.i386 from remi-php56 has depsolving problems
  --> Missing Dependency: libedit.so.0 is needed by package php-cli-5.6.30-1.el5.remi.i386 (remi-php56)

libedit.so.0 が存在しないようですのでインストールします。

#yum list --enablerepo=epel,remi,remi-php56 | grep libedit
#yum --enablerepo=epel install libedit

再度実行して問題がなかったので、
最初にメモした関連パッケージのインストール

#yum install php-mysqlnd php-mysql php-gd php-mbstring php-pdo php-odbc php-xml #php-pear php-devel php-mcrypt --enablerepo=remi,remi-php56

またまた怒られる

error
php-gd-5.6.30-1.el5.remi.i386 from remi-php56 has depsolving problems
  --> Missing Dependency: libt1.so.5 is needed by package php-gd-5.6.30-1.el5.remi.i386 (remi-php56)

libt1.so.5 が存在しないようですのでインストールします。

#yum list --enablerepo=epel,remi,remi-php56 | grep t1lib
#yum --enablerepo=epel,remi,remi-php56 install t1lib

再度実行して問題がなかったのでphpのバージョン確認して5.6にアップデートされていることを確認します。

#php -v

最後にapache起動

#/etc/init.d/httpd configtest
#/etc/init.d/httpd start

以上。

参考URL

yumリポジトリ一追加リスト 完全版
http://qiita.com/bezeklik/items/9766003c19f9664602fe

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4