huruyosi’s blog

プログラミングとかインフラとかのメモです。

CentOS 5.11 に PHP5.6をインストールする

検索するといくつかのブログがあるのだけど、たぶん、環境依存のために変更が必要だった。

labs.cybridge.jp

epelとremiのパッケージリポジトリを登録

$ sudo rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
$ sudo rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm

パッケージを確認

$ sudo yum list --enablerepo=remi-php56 --disablerepo=updates --disablerepo=base |grep php\.x86
graphviz-php.x86_64                        2.12-8.el5.centos          extras
mnogosearch-php.x86_64                     3.3.11-1.el5.rf            rpmforge
mod_suphp.x86_64                           0.7.1-1.el5.rf             rpmforge
nntpgrab-php.x86_64                        0.7.2-1.el5                epel
php.x86_64                                 5.6.8-1.el5.remi           remi-php56
remctl-php.x86_64                          3.9-2.el5                  epel
rrdtool-php.x86_64                         1.2.27-4.el5               epel
syck-php.x86_64                            0.55-10.el5                epel
uuid-php.x86_64                            1.5.1-3.el5                epel

updatesリポジトリとbaseリポジトリが有効になっていると remi-php56 に登録されているphpが対象にならなかった

パッケージをインストール

$ sudo yum install php --enablerepo=remi --enablerepo=remi-php56 --disablerepo=epel --disablerepo=updates --disablerepo=base

実際にはphpのモジュールは適宜指定する。yum listと比較して--disablerepo=epelを追加しているのは下のエラーメッセージが出たから。epelにあるlibcurlに依存している。

--> Finished Dependency Resolution
php-common-5.6.8-1.el5.remi.x86_64 from remi-php56 has depsolving problems
  --> Missing Dependency: libcurl.so.4()(64bit) is needed by package php-common-5.6.8-1.el5.remi.x86_64 (remi-php56)
Error: Missing Dependency: libcurl.so.4()(64bit) is needed by package php-common-5.6.8-1.el5.remi.x86_64 (remi-php56)
 You could try using --skip-broken to work around the problem
 You could try running: package-cleanup --problems
                        package-cleanup --dupes
                        rpm -Va --nofiles --nodigest
The program package-cleanup is found in the yum-utils package.