LoginSignup
39

More than 5 years have passed since last update.

CentOS6.6に php5.5をインストールしてみる。

Last updated at Posted at 2015-02-08

CentOS6.6に php5.5をインストールしてみます。

環境
CentOS:6.6 (64bit)

リポジトリを追加する

まずepelのリポジトリを追加します。

sudo rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

次にremiのリポジトリを追加します。

sudo rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

これでレポジトリの追加は完了です。

CentOS-Baseリポジトリを一時的にきる

priorityなどで設定もできると思いますが、今回は一時的にCentOS-Baseリポジトリをきります。
これが有効だと 今ですと php5.3がインストールされてしまいます。 (2015/02/09現在)

vi /etc/yum.repos.d/CentOS-Base.repo

CentOS-Base.repo
[base]
enabled=0
[updates]
enabled=0
[extras]
enabled=0
[centosplus]
enabled=0
[contrib]
enabled=0

上記のように enabled の部分を 0 にすると無効にすることができます。
enabled= の記述がない場合は追記してください。

php5.5をインストールする

では php5.5をインストールしていきましょう。

yum install --enablerepo=remi --enablerepo=remi-php55 php php-devel php-mbstring php-mcrypt php-mysql

上記でphp5.5がインストールできます。

errorがでて

You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest

のような表示が出た場合は

yum install --skip-broken --enablerepo=remi --enablerepo=remi-php55 php php-devel php-mbstring php-mcrypt php-mysql

でインストールができると思います。

phpのバージョンを確認

php --version
PHP 5.5.21 (cli) (built: Jan 21 2015 15:35:14)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies

最後にCentOS-Base.repoのenabledの部分を元に戻して完了です。

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
39