04/13 CentOS 5.11にPHP5.6.7をインストールする

PHPのアップデートは簡単にできた、みたいなことを書いていたが実際にはいろいろ抜けているパッケージがあったりしたので、削除してもう一度インストールし直してみた。

まず、現在入っているPHPを確認する。

$ php --version
PHP 5.4.39 (cli) (built: Mar 19 2015 07:08:22)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
$ rpm -q php-mysql
パッケージ php-mysql はインストールされていません。
[masaru@ns www]$ rpm -qa php*
php-cli-5.4.39-1.el5.remi
php-5.4.39-1.el5.remi
php-pdo-5.4.39-1.el5.remi
php-gd-5.4.39-1.el5.remi
php-common-5.4.39-1.el5.remi
php-xml-5.4.39-1.el5.remi
php-devel-5.4.39-1.el5.remi
php-mbstring-5.4.39-1.el5.remi

PHP 5.4.39がインストールされていた。php-mysqlは入ってないという。PHPの最新版は5.6.7なので、全部入れ替える。

$ sudo yum erase php
Setting up Remove Process
Resolving Dependencies
--> Running transaction check
---> Package php.x86_64 0:5.4.39-1.el5.remi set to be erased
--> Finished Dependency Resolution

Dependencies Resolved

==========================================================================================
 Package        Arch              Version                      Repository            Size
==========================================================================================
Removing:
 php            x86_64            5.4.39-1.el5.remi            installed            8.9 M

Transaction Summary
==========================================================================================
Remove        1 Package(s)
Reinstall     0 Package(s)
Downgrade     0 Package(s)

Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Erasing        : php                                                                1/1

Removed:
  php.x86_64 0:5.4.39-1.el5.remi

Complete!

同様に5.4.39の他のパッケージも削除する。

$ rpm -qa | grep php
php-cli-5.4.39-1.el5.remi
php-pdo-5.4.39-1.el5.remi
php-gd-5.4.39-1.el5.remi
php-common-5.4.39-1.el5.remi
php-xml-5.4.39-1.el5.remi
php-devel-5.4.39-1.el5.remi
php-mbstring-5.4.39-1.el5.remi
$ sudo yum erase php-common
Setting up Remove Process
Resolving Dependencies
--> Running transaction check
---> Package php-common.x86_64 0:5.4.39-1.el5.remi set to be erased
--> Processing Dependency: php-common = 5.4.39-1.el5.remi for package: php-gd
--> Processing Dependency: php-common = 5.4.39-1.el5.remi for package: php-xml
--> Processing Dependency: php-common = 5.4.39-1.el5.remi for package: php-cli
--> Processing Dependency: php-common = 5.4.39-1.el5.remi for package: php-mbstring
--> Processing Dependency: php-common = 5.4.39-1.el5.remi for package: php-pdo
--> Running transaction check
---> Package php-cli.x86_64 0:5.4.39-1.el5.remi set to be erased
--> Processing Dependency: php-cli = 5.4.39-1.el5.remi for package: php-devel
---> Package php-gd.x86_64 0:5.4.39-1.el5.remi set to be erased
---> Package php-mbstring.x86_64 0:5.4.39-1.el5.remi set to be erased
---> Package php-pdo.x86_64 0:5.4.39-1.el5.remi set to be erased
---> Package php-xml.x86_64 0:5.4.39-1.el5.remi set to be erased
--> Running transaction check
---> Package php-devel.x86_64 0:5.4.39-1.el5.remi set to be erased
--> Finished Dependency Resolution

Dependencies Resolved

==========================================================================================
 Package              Arch           Version                      Repository         Size
==========================================================================================
Removing:
 php-common           x86_64         5.4.39-1.el5.remi            installed         6.9 M
Removing for dependencies:
 php-cli              x86_64         5.4.39-1.el5.remi            installed          11 M
 php-devel            x86_64         5.4.39-1.el5.remi            installed         7.9 M
 php-gd               x86_64         5.4.39-1.el5.remi            installed         649 k
 php-mbstring         x86_64         5.4.39-1.el5.remi            installed         2.5 M
 php-pdo              x86_64         5.4.39-1.el5.remi            installed         245 k
 php-xml              x86_64         5.4.39-1.el5.remi            installed         611 k

Transaction Summary
==========================================================================================
Remove        7 Package(s)
Reinstall     0 Package(s)
Downgrade     0 Package(s)

Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Erasing        : php-common                                                         1/7
警告: /etc/php.ini は /etc/php.ini.rpmsave として保存されました。
  Erasing        : php-xml                                                            2/7
  Erasing        : php-mbstring                                                       3/7
  Erasing        : php-pdo                                                            4/7
  Erasing        : php-cli                                                            5/7
  Erasing        : php-devel                                                          6/7
  Erasing        : php-gd                                                             7/7

Removed:
  php-common.x86_64 0:5.4.39-1.el5.remi

Dependency Removed:
  php-cli.x86_64 0:5.4.39-1.el5.remi        php-devel.x86_64 0:5.4.39-1.el5.remi
  php-gd.x86_64 0:5.4.39-1.el5.remi         php-mbstring.x86_64 0:5.4.39-1.el5.remi
  php-pdo.x86_64 0:5.4.39-1.el5.remi        php-xml.x86_64 0:5.4.39-1.el5.remi

Complete!

yumのパッケージを確認する。標準レポジトリには5.6.7は入ってなく、remi、remi-php56を指定しないといけない。

$ yum list --enablerepo=remi --enablerepo=remi-php56 | grep php56
apcu-panel.x86_64                          4.0.7-1.el5.remi.5.6       remi-php56
apm-web.x86_64                             2.0.0-2.el5.remi.5.6       remi-php56
mysqlnd-qc-panel.x86_64                    1.2.0-5.el5.remi.5.6       remi-php56
php.x86_64                                 5.6.7-1.el5.remi           remi-php56
php-bcmath.x86_64                          5.6.7-1.el5.remi           remi-php56
php-cli.x86_64                             5.6.7-1.el5.remi           remi-php56
php-common.x86_64                          5.6.7-1.el5.remi           remi-php56
php-dba.x86_64                             5.6.7-1.el5.remi           remi-php56
php-dbg.x86_64                             5.6.7-1.el5.remi           remi-php56
php-devel.x86_64                           5.6.7-1.el5.remi           remi-php56
php-embedded.x86_64                        5.6.7-1.el5.remi           remi-php56
php-enchant.x86_64                         5.6.7-1.el5.remi           remi-php56
php-fpm.x86_64                             5.6.7-1.el5.remi           remi-php56
php-gd.x86_64                              5.6.7-1.el5.remi           remi-php56
php-gmp.x86_64                             5.6.7-1.el5.remi           remi-php56
php-horde-horde-lz4.x86_64                 1.0.7-1.el5.remi.5.6       remi-php56
php-idn.x86_64                             1.2c-9.el5.remi.5.6        remi-php56
php-imap.x86_64                            5.6.7-1.el5.remi           remi-php56
php-interbase.x86_64                       5.6.7-1.el5.remi           remi-php56
php-intl.x86_64                            5.6.7-1.el5.remi           remi-php56
php-ioncube-loader.x86_64                  4.7.5-1.el5.remi.5.6       remi-php56
php-json.x86_64                            1.3.7-1.el5.remi.5.6       remi-php56
php-ldap.x86_64                            5.6.7-1.el5.remi           remi-php56
php-litespeed.x86_64                       5.6.7-1.el5.remi           remi-php56
php-magickwand.x86_64                      1.0.9.2-9.el5.remi.5.6     remi-php56
php-mbstring.x86_64                        5.6.7-1.el5.remi           remi-php56
php-mcrypt.x86_64                          5.6.7-1.el5.remi           remi-php56
php-mssql.x86_64                           5.6.7-1.el5.remi           remi-php56
php-mysqlnd.x86_64                         5.6.7-1.el5.remi           remi-php56
…(以下省略)

必要なパッケージをyumでインストールする。

$ sudo yum install --enablerepo=remi php.x86_64
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package php.x86_64 0:5.4.39-1.el5.remi set to be updated
--> Processing Dependency: php-common = 5.4.39-1.el5.remi for package: php
--> Processing Dependency: php-cli = 5.4.39-1.el5.remi for package: php
--> Running transaction check
---> Package php-cli.x86_64 0:5.4.39-1.el5.remi set to be updated
---> Package php-common.x86_64 0:5.4.39-1.el5.remi set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

==========================================================================================
 Package              Arch             Version                       Repository      Size
==========================================================================================
Installing:
 php                  x86_64           5.4.39-1.el5.remi             remi           3.1 M
Installing for dependencies:
 php-cli              x86_64           5.4.39-1.el5.remi             remi           4.4 M
 php-common           x86_64           5.4.39-1.el5.remi             remi           1.1 M

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

Total download size: 8.6 M
Is this ok [y/N]: n
Exiting on user Command
Complete!

他のパッケージも入れる。

$ sudo yum install --enablerepo=remi-php56 php
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package php.x86_64 0:5.6.7-1.el5.remi set to be updated
--> Processing Dependency: php-common = 5.6.7-1.el5.remi for package: php
--> Processing Dependency: php-cli = 5.6.7-1.el5.remi for package: php
--> Running transaction check
---> Package php-cli.x86_64 0:5.6.7-1.el5.remi set to be updated
---> Package php-common.x86_64 0:5.6.7-1.el5.remi set to be updated
--> Processing Dependency: php-pecl-zip for package: php-common
--> Processing Dependency: php-pecl-jsonc for package: php-common
--> Running transaction check
---> Package php-pecl-jsonc.x86_64 0:1.3.7-1.el5.remi.5.6 set to be updated
---> Package php-pecl-zip.x86_64 0:1.12.4-2.el5.remi.5.6 set to be updated
--> Processing Dependency: /usr/bin/pecl for package: php-pecl-zip
--> Running transaction check
---> Package php-pear.noarch 1:1.4.9-8.el5 set to be updated
--> Processing Dependency: php-devel for package: php-pear
--> Running transaction check
---> Package php-devel.x86_64 0:5.6.7-1.el5.remi set to be updated
--> Processing Dependency: php-pecl-jsonc-devel for package: php-devel
--> Running transaction check
---> Package php-pecl-jsonc-devel.x86_64 0:1.3.7-1.el5.remi.5.6 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

==========================================================================================
 Package                   Arch        Version                      Repository       Size
==========================================================================================
Installing:
 php                       x86_64      5.6.7-1.el5.remi             remi-php56      3.0 M
Installing for dependencies:
 php-cli                   x86_64      5.6.7-1.el5.remi             remi-php56      4.2 M
 php-common                x86_64      5.6.7-1.el5.remi             remi-php56      1.2 M
 php-devel                 x86_64      5.6.7-1.el5.remi             remi-php56      1.5 M
 php-pear                  noarch      1:1.4.9-8.el5                base            344 k
 php-pecl-jsonc            x86_64      1.3.7-1.el5.remi.5.6         remi-php56       72 k
 php-pecl-jsonc-devel      x86_64      1.3.7-1.el5.remi.5.6         remi-php56       25 k
 php-pecl-zip              x86_64      1.12.4-2.el5.remi.5.6        remi-php56      313 k

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

Total download size: 11 M
Is this ok [y/N]: y
Downloading Packages:
(1/8): php-pecl-jsonc-devel-1.3.7-1.el5.remi.5.6.x86_64.rpm        |  25 kB     00:00
(2/8): php-pecl-jsonc-1.3.7-1.el5.remi.5.6.x86_64.rpm              |  72 kB     00:00
(3/8): php-pecl-zip-1.12.4-2.el5.remi.5.6.x86_64.rpm               | 313 kB     00:01
(4/8): php-pear-1.4.9-8.el5.noarch.rpm                             | 344 kB     00:00
(5/8): php-common-5.6.7-1.el5.remi.x86_64.rpm                      | 1.2 MB     00:05
(6/8): php-devel-5.6.7-1.el5.remi.x86_64.rpm                       | 1.5 MB     00:07
(7/8): php-5.6.7-1.el5.remi.x86_64.rpm                             | 3.0 MB     00:14
(8/8): php-cli-5.6.7-1.el5.remi.x86_64.rpm                         | 4.2 MB     00:20
------------------------------------------------------------------------------------------
Total                                                     206 kB/s |  11 MB     00:52
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : php-cli                                                            1/8
  Installing     : php-pear                                                           2/8

WARNING : These php-* RPM are not official Fedora / Red Hat build and
overrides the official ones. Don't file bugs on Fedora Project nor Red Hat.

Use dedicated forums http://forums.famillecollet.com/

  Installing     : php-common                                                         3/8
  Installing     : php-pecl-jsonc                                                     4/8
  Installing     : php-devel                                                          5/8
  Installing     : php-pecl-zip                                                       6/8
  Installing     : php                                                                7/8
  Installing     : php-pecl-jsonc-devel                                               8/8

Installed:
  php.x86_64 0:5.6.7-1.el5.remi

Dependency Installed:
  php-cli.x86_64 0:5.6.7-1.el5.remi
  php-common.x86_64 0:5.6.7-1.el5.remi
  php-devel.x86_64 0:5.6.7-1.el5.remi
  php-pear.noarch 1:1.4.9-8.el5
  php-pecl-jsonc.x86_64 0:1.3.7-1.el5.remi.5.6
  php-pecl-jsonc-devel.x86_64 0:1.3.7-1.el5.remi.5.6
  php-pecl-zip.x86_64 0:1.12.4-2.el5.remi.5.6

Complete!

そしてphp-mysqlをインストール。

$ sudo yum install --enablerepo=remi-php56 php-mysql.x86_64
Setting up Install Process
Package php-mysql is obsoleted by php-mysqlnd, trying to install php-mysqlnd-5.6.7-1.el5.remi.x86_64 instead
Resolving Dependencies
--> Running transaction check
---> Package php-mysqlnd.x86_64 0:5.6.7-1.el5.remi set to be updated
--> Processing Dependency: php-pdo = 5.6.7-1.el5.remi for package: php-mysqlnd
--> Running transaction check
---> Package php-pdo.x86_64 0:5.6.7-1.el5.remi set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

==========================================================================================
 Package              Arch            Version                   Repository           Size
==========================================================================================
Installing:
 php-mysqlnd          x86_64          5.6.7-1.el5.remi          remi-php56          366 k
Installing for dependencies:
 php-pdo              x86_64          5.6.7-1.el5.remi          remi-php56          126 k

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

Total download size: 491 k
Is this ok [y/N]: y
Downloading Packages:
(1/2): php-pdo-5.6.7-1.el5.remi.x86_64.rpm                         | 126 kB     00:01
(2/2): php-mysqlnd-5.6.7-1.el5.remi.x86_64.rpm                     | 366 kB     00:01
------------------------------------------------------------------------------------------
Total                                                     140 kB/s | 491 kB     00:03
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : php-pdo                                                            1/2
  Installing     : php-mysqlnd                                                        2/2

Installed:
  php-mysqlnd.x86_64 0:5.6.7-1.el5.remi

Dependency Installed:
  php-pdo.x86_64 0:5.6.7-1.el5.remi

Complete!

だいたい必要なものは入ったようだ。
httpdを再起動する。

$ sudo /etc/rc.d/init.d/httpd restart
httpd を停止中:                                            [  OK  ]
httpd を起動中:                                            [  OK  ]

PHPのバージョンを確認する。

$ php --version
PHP 5.6.7 (cli) (built: Mar 19 2015 15:19:49)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies

これでPHPのアップグレードも完了した。

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

*

このサイトはスパムを低減するために Akismet を使っています。コメントデータの処理方法の詳細はこちらをご覧ください