CentOS 6 PHP 업그레이드 5.3 → 5.6 (rpm)

  다른 뜻에 대해서는 CentOS 6 PHP 업그레이드 5.3 → 5.6 (yum) 문서를 참조하십시오.
CentOS 6 PHP 업그레이드 5.3 → 5.6

1 서버 확인[ | ]

Console
Copy
[root@zetawiki ~]# php -v
PHP 5.3.3 (cli) (built: Oct 30 2014 20:12:53) 
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
Console
Copy
[root@zetawiki ~]# rpm -qa | grep php | sort
php-5.3.3-40.el6_6.x86_64
php-cli-5.3.3-40.el6_6.x86_64
php-common-5.3.3-40.el6_6.x86_64
php-devel-5.3.3-40.el6_6.x86_64
php-gd-5.3.3-40.el6_6.x86_64
php-mbstring-5.3.3-40.el6_6.x86_64
php-mcrypt-5.3.3-1.el6.x86_64
php-mysql-5.3.3-40.el6_6.x86_64
php-pdo-5.3.3-40.el6_6.x86_64
php-pear-1.9.4-4.el6.noarch
php-pecl-ssh2-0.11.0-7.el6.x86_64
php-pgsql-5.3.3-40.el6_6.x86_64
php-xml-5.3.3-40.el6_6.x86_64
php-zts-5.3.3-40.el6_6.x86_64
→ PHP 5.3이 설치되어 있음

2 작업PC 확인[ | ]

  • 사전작업: yum remi 저장소 추가
  • 인터넷이 되는 작업PC(workstation)에서 yum 저장소의 php56 패키지들 확인
Console
Copy
[root@workstation ~]# yum list | grep php56 | egrep 'php-cli|php-common|php-devel|php-gd|php-mbstring|php-mcrypt|php-mysql|php-pdo|php-pear|php-pecl-ssh2|php-pgsql|php-xml|php-zts' | 
php56-php-cli.x86_64                       5.6.25-1.el6.remi           remi-safe
php56-php-common.x86_64                    5.6.25-1.el6.remi           remi-safe
php56-php-devel.x86_64                     5.6.25-1.el6.remi           remi-safe
php56-php-gd.x86_64                        5.6.25-1.el6.remi           remi-safe
php56-php-mbstring.x86_64                  5.6.25-1.el6.remi           remi-safe
php56-php-mcrypt.x86_64                    5.6.25-1.el6.remi           remi-safe
php56-php-mysqlnd.x86_64                   5.6.25-1.el6.remi           remi-safe
php56-php-pdo.x86_64                       5.6.25-1.el6.remi           remi-safe
php56-php-pear.noarch                      1:1.10.1-6.el6.remi         remi-safe
php56-php-pecl-ssh2.x86_64                 0.13-1.el6.remi             remi-safe
php56-php-pgsql.x86_64                     5.6.25-1.el6.remi           remi-safe
php56-php-xml.x86_64                       5.6.25-1.el6.remi           remi-safe
php56-php-xmlrpc.x86_64                    5.6.25-1.el6.remi           remi-safe
→ php-mysql은 php-mysqlnd로 바뀌었고, php-zts는 없다.

3 rpm 다운로드[ | ]

  • 작업PC에서 rpm 패키지 다운로드
Console
Copy
[root@workstation ~]# mkdir php56_rpms
[root@workstation php56_rpms]# cd php56_rpms/
[root@workstation php56_rpms]# yum list | grep php56 | egrep 'php-cli|php-common|php-devel|php-gd|php-mbstring|php-mcrypt|php-mysql|php-pdo|php-pear|php-pecl-ssh2|php-pgsql|php-xml|php-zts' | awk '{print $1}'
php56-php-cli.x86_64
php56-php-common.x86_64
php56-php-devel.x86_64
php56-php-gd.x86_64
php56-php-mbstring.x86_64
php56-php-mcrypt.x86_64
php56-php-mysqlnd.x86_64
php56-php-pdo.x86_64
php56-php-pear.noarch
php56-php-pecl-ssh2.x86_64
php56-php-pgsql.x86_64
php56-php-xml.x86_64
php56-php-xmlrpc.x86_64
[root@workstation php56_rpms]# yum downloader php56-php
... (생략)
php56-php-5.6.25-1.el6.remi.x86_64.rpm                              | 1.4 MB     00:02  
[root@workstation php56_rpms]# yum list | grep php56 | egrep 'php-cli|php-common|php-devel|php-gd|php-mbstring|php-mcrypt|php-mysql|php-pdo|php-pear|php-pecl-ssh2|php-pgsql|php-xml|php-zts' | awk '{print $1}' | xargs yumdownloader --resolve
... (생략)
php56-php-cli-5.6.25-1.el6.remi.x86_64.rpm                          | 2.6 MB     00:03     
php56-php-common-5.6.25-1.el6.remi.x86_64.rpm                       | 691 kB     00:00     
php56-php-devel-5.6.25-1.el6.remi.x86_64.rpm                        | 645 kB     00:00     
php56-php-gd-5.6.25-1.el6.remi.x86_64.rpm                           |  65 kB     00:00     
php56-php-mbstring-5.6.25-1.el6.remi.x86_64.rpm                     | 509 kB     00:00     
php56-php-mcrypt-5.6.25-1.el6.remi.x86_64.rpm                       |  48 kB     00:00     
php56-php-mysqlnd-5.6.25-1.el6.remi.x86_64.rpm                      | 175 kB     00:00     
php56-php-pdo-5.6.25-1.el6.remi.x86_64.rpm                          |  90 kB     00:00     
php56-php-pear-1.10.1-6.el6.remi.noarch.rpm                         | 366 kB     00:00     
php56-php-pecl-ssh2-0.13-1.el6.remi.x86_64.rpm                      |  34 kB     00:00     
php56-php-pgsql-5.6.25-1.el6.remi.x86_64.rpm                        |  90 kB     00:00     
php56-php-xml-5.6.25-1.el6.remi.x86_64.rpm                          | 147 kB     00:00     
php56-php-xmlrpc-5.6.25-1.el6.remi.x86_64.rpm                       |  66 kB     00:00     
libzip-last-1.1.3-1.el6.remi.x86_64.rpm                             |  42 kB     00:00     
php56-php-process-5.6.25-1.el6.remi.x86_64.rpm                      |  55 kB     00:00     
setools-libs-python-3.3.7-4.el6.x86_64.rpm                          | 222 kB     00:00     
tcl-8.5.7-6.el6.x86_64.rpm                                          | 1.9 MB     00:00     
php56-php-pecl-jsonc-devel-1.3.10-1.el6.remi.x86_64.rpm             |  31 kB     00:00     
php56-php-pecl-zip-1.13.4-1.el6.remi.x86_64.rpm                     |  40 kB     00:00     
libsemanage-python-2.0.43-5.1.el6.x86_64.rpm                        |  81 kB     00:00     
audit-2.4.5-3.el6.x86_64.rpm                                        | 214 kB     00:00     
libselinux-devel-2.0.94-7.el6.x86_64.rpm                            | 137 kB     00:00     
setools-libs-3.3.7-4.el6.x86_64.rpm                                 | 400 kB     00:00     
libsemanage-2.0.43-5.1.el6.x86_64.rpm                               | 104 kB     00:00     
environment-modules-3.2.10-3.el6.x86_64.rpm                         | 103 kB     00:00     
libselinux-python-2.0.94-7.el6.x86_64.rpm                           | 203 kB     00:00     
policycoreutils-2.0.83-29.el6.x86_64.rpm                            | 663 kB     00:00     
libwebp-0.4.3-3.el6.x86_64.rpm                                      | 210 kB     00:00     
libselinux-utils-2.0.94-7.el6.x86_64.rpm                            |  82 kB     00:00     
php56-runtime-2.1-5.el6.remi.x86_64.rpm                             | 1.0 MB     00:00     
libselinux-2.0.94-7.el6.x86_64.rpm                                  | 109 kB     00:00     
audit-libs-2.4.5-3.el6.x86_64.rpm                                   |  74 kB     00:00     
policycoreutils-python-2.0.83-29.el6.x86_64.rpm                     | 437 kB     00:00     
audit-libs-python-2.4.5-3.el6.x86_64.rpm                            |  63 kB     00:00     
php56-php-pecl-jsonc-1.3.10-1.el6.remi.x86_64.rpm                   |  42 kB     00:00     
gd-last-2.2.3-1.el6.remi.x86_64.rpm                                 | 126 kB     00:00
[root@workstation php56_rpms]# ls
audit-2.4.5-3.el6.x86_64.rpm
audit-libs-2.4.5-3.el6.x86_64.rpm
audit-libs-python-2.4.5-3.el6.x86_64.rpm
environment-modules-3.2.10-3.el6.x86_64.rpm
gd-last-2.2.3-1.el6.remi.x86_64.rpm
libselinux-2.0.94-7.el6.x86_64.rpm
libselinux-devel-2.0.94-7.el6.x86_64.rpm
libselinux-python-2.0.94-7.el6.x86_64.rpm
libselinux-utils-2.0.94-7.el6.x86_64.rpm
libsemanage-2.0.43-5.1.el6.x86_64.rpm
libsemanage-python-2.0.43-5.1.el6.x86_64.rpm
libwebp-0.4.3-3.el6.x86_64.rpm
libzip-last-1.1.3-1.el6.remi.x86_64.rpm
php56-php-5.6.25-1.el6.remi.x86_64.rpm
php56-php-cli-5.6.25-1.el6.remi.x86_64.rpm
php56-php-common-5.6.25-1.el6.remi.x86_64.rpm
php56-php-devel-5.6.25-1.el6.remi.x86_64.rpm
php56-php-gd-5.6.25-1.el6.remi.x86_64.rpm
php56-php-mbstring-5.6.25-1.el6.remi.x86_64.rpm
php56-php-mcrypt-5.6.25-1.el6.remi.x86_64.rpm
php56-php-mysqlnd-5.6.25-1.el6.remi.x86_64.rpm
php56-php-pdo-5.6.25-1.el6.remi.x86_64.rpm
php56-php-pear-1.10.1-6.el6.remi.noarch.rpm
php56-php-pecl-jsonc-1.3.10-1.el6.remi.x86_64.rpm
php56-php-pecl-jsonc-devel-1.3.10-1.el6.remi.x86_64.rpm
php56-php-pecl-ssh2-0.13-1.el6.remi.x86_64.rpm
php56-php-pecl-zip-1.13.4-1.el6.remi.x86_64.rpm
php56-php-pgsql-5.6.25-1.el6.remi.x86_64.rpm
php56-php-process-5.6.25-1.el6.remi.x86_64.rpm
php56-php-xml-5.6.25-1.el6.remi.x86_64.rpm
php56-php-xmlrpc-5.6.25-1.el6.remi.x86_64.rpm
php56-runtime-2.1-5.el6.remi.x86_64.rpm
policycoreutils-2.0.83-29.el6.x86_64.rpm
policycoreutils-python-2.0.83-29.el6.x86_64.rpm
setools-libs-3.3.7-4.el6.x86_64.rpm
setools-libs-python-3.3.7-4.el6.x86_64.rpm
tcl-8.5.7-6.el6.x86_64.rpm

4 rpm 업로드 및 설치[ | ]

  • 작업PC에서 수집한 rpm 파일들을 서버에 업로드
Console
Copy
[root@zetawiki php56_rpms]# ls
audit-2.4.5-3.el6.x86_64.rpm                     php56-php-mcrypt-5.6.25-1.el6.remi.x86_64.rpm
audit-libs-2.4.5-3.el6.x86_64.rpm                php56-php-mysqlnd-5.6.25-1.el6.remi.x86_64.rpm
audit-libs-python-2.4.5-3.el6.x86_64.rpm         php56-php-pdo-5.6.25-1.el6.remi.x86_64.rpm
environment-modules-3.2.10-3.el6.x86_64.rpm      php56-php-pear-1.10.1-6.el6.remi.noarch.rpm
gd-last-2.2.3-1.el6.remi.x86_64.rpm              php56-php-pecl-jsonc-1.3.10-1.el6.remi.x86_64.rpm
libselinux-2.0.94-7.el6.x86_64.rpm               php56-php-pecl-jsonc-devel-1.3.10-1.el6.remi.x86_64.rpm
libselinux-devel-2.0.94-7.el6.x86_64.rpm         php56-php-pecl-ssh2-0.13-1.el6.remi.x86_64.rpm
libselinux-python-2.0.94-7.el6.x86_64.rpm        php56-php-pecl-zip-1.13.4-1.el6.remi.x86_64.rpm
libselinux-utils-2.0.94-7.el6.x86_64.rpm         php56-php-pgsql-5.6.25-1.el6.remi.x86_64.rpm
libsemanage-2.0.43-5.1.el6.x86_64.rpm            php56-php-process-5.6.25-1.el6.remi.x86_64.rpm
libsemanage-python-2.0.43-5.1.el6.x86_64.rpm     php56-php-xml-5.6.25-1.el6.remi.x86_64.rpm
libwebp-0.4.3-3.el6.x86_64.rpm                   php56-php-xmlrpc-5.6.25-1.el6.remi.x86_64.rpm
libzip-last-1.1.3-1.el6.remi.x86_64.rpm          php56-runtime-2.1-5.el6.remi.x86_64.rpm
php56-php-5.6.25-1.el6.remi.x86_64.rpm           policycoreutils-2.0.83-29.el6.x86_64.rpm
php56-php-cli-5.6.25-1.el6.remi.x86_64.rpm       policycoreutils-python-2.0.83-29.el6.x86_64.rpm
php56-php-common-5.6.25-1.el6.remi.x86_64.rpm    setools-libs-3.3.7-4.el6.x86_64.rpm
php56-php-devel-5.6.25-1.el6.remi.x86_64.rpm     setools-libs-python-3.3.7-4.el6.x86_64.rpm
php56-php-gd-5.6.25-1.el6.remi.x86_64.rpm        tcl-8.5.7-6.el6.x86_64.rpm
php56-php-mbstring-5.6.25-1.el6.remi.x86_64.rpm
  • yum으로 rpm 설치
Console
Copy
[root@zetawiki php56_rpms]# yum install *.rpm
... (생략)
==================================================================================================================
 Package                    Arch   Version             Repository                                            Size
==================================================================================================================
Installing:
 audit-libs-python          x86_64 2.4.5-3.el6         /audit-libs-python-2.4.5-3.el6.x86_64                279 k
 environment-modules        x86_64 3.2.10-3.el6        /environment-modules-3.2.10-3.el6.x86_64             210 k
 gd-last                    x86_64 2.2.3-1.el6.remi    /gd-last-2.2.3-1.el6.remi.x86_64                     396 k
 libselinux-python          x86_64 2.0.94-7.el6        /libselinux-python-2.0.94-7.el6.x86_64               657 k
 libsemanage-python         x86_64 2.0.43-5.1.el6      /libsemanage-python-2.0.43-5.1.el6.x86_64            312 k
 libwebp                    x86_64 0.4.3-3.el6         /libwebp-0.4.3-3.el6.x86_64                          659 k
 libzip-last                x86_64 1.1.3-1.el6.remi    /libzip-last-1.1.3-1.el6.remi.x86_64                  78 k
 php56-php                  x86_64 5.6.25-1.el6.remi   /php56-php-5.6.25-1.el6.remi.x86_64                  4.4 M
 php56-php-cli              x86_64 5.6.25-1.el6.remi   /php56-php-cli-5.6.25-1.el6.remi.x86_64              7.7 M
 php56-php-common           x86_64 5.6.25-1.el6.remi   /php56-php-common-5.6.25-1.el6.remi.x86_64           4.3 M
 php56-php-devel            x86_64 5.6.25-1.el6.remi   /php56-php-devel-5.6.25-1.el6.remi.x86_64            4.2 M
 php56-php-gd               x86_64 5.6.25-1.el6.remi   /php56-php-gd-5.6.25-1.el6.remi.x86_64               113 k
 php56-php-mbstring         x86_64 5.6.25-1.el6.remi   /php56-php-mbstring-5.6.25-1.el6.remi.x86_64         1.4 M
 php56-php-mcrypt           x86_64 5.6.25-1.el6.remi   /php56-php-mcrypt-5.6.25-1.el6.remi.x86_64            44 k
 php56-php-mysqlnd          x86_64 5.6.25-1.el6.remi   /php56-php-mysqlnd-5.6.25-1.el6.remi.x86_64          478 k
 php56-php-pdo              x86_64 5.6.25-1.el6.remi   /php56-php-pdo-5.6.25-1.el6.remi.x86_64              172 k
 php56-php-pear             noarch 1:1.10.1-6.el6.remi /php56-php-pear-1.10.1-6.el6.remi.noarch             2.1 M
 php56-php-pecl-jsonc       x86_64 1.3.10-1.el6.remi   /php56-php-pecl-jsonc-1.3.10-1.el6.remi.x86_64       101 k
 php56-php-pecl-jsonc-devel x86_64 1.3.10-1.el6.remi   /php56-php-pecl-jsonc-devel-1.3.10-1.el6.remi.x86_64 120 k
 php56-php-pecl-ssh2        x86_64 0.13-1.el6.remi     /php56-php-pecl-ssh2-0.13-1.el6.remi.x86_64           87 k
 php56-php-pecl-zip         x86_64 1.13.4-1.el6.remi   /php56-php-pecl-zip-1.13.4-1.el6.remi.x86_64         109 k
 php56-php-pgsql            x86_64 5.6.25-1.el6.remi   /php56-php-pgsql-5.6.25-1.el6.remi.x86_64            174 k
 php56-php-process          x86_64 5.6.25-1.el6.remi   /php56-php-process-5.6.25-1.el6.remi.x86_64           75 k
 php56-php-xml              x86_64 5.6.25-1.el6.remi   /php56-php-xml-5.6.25-1.el6.remi.x86_64              406 k
 php56-php-xmlrpc           x86_64 5.6.25-1.el6.remi   /php56-php-xmlrpc-5.6.25-1.el6.remi.x86_64            77 k
 php56-runtime              x86_64 2.1-5.el6.remi      /php56-runtime-2.1-5.el6.remi.x86_64                  21 k
 policycoreutils-python     x86_64 2.0.83-29.el6       /policycoreutils-python-2.0.83-29.el6.x86_64         1.3 M
 setools-libs               x86_64 3.3.7-4.el6         /setools-libs-3.3.7-4.el6.x86_64                     1.1 M
 setools-libs-python        x86_64 3.3.7-4.el6         /setools-libs-python-3.3.7-4.el6.x86_64              1.6 M
Updating:
 audit                      x86_64 2.4.5-3.el6         /audit-2.4.5-3.el6.x86_64                            583 k
 audit-libs                 x86_64 2.4.5-3.el6         /audit-libs-2.4.5-3.el6.x86_64                       230 k
 libselinux                 x86_64 2.0.94-7.el6        /libselinux-2.0.94-7.el6.x86_64                      127 k
 libselinux-devel           x86_64 2.0.94-7.el6        /libselinux-devel-2.0.94-7.el6.x86_64                159 k
 libselinux-utils           x86_64 2.0.94-7.el6        /libselinux-utils-2.0.94-7.el6.x86_64                 61 k
 libsemanage                x86_64 2.0.43-5.1.el6      /libsemanage-2.0.43-5.1.el6.x86_64                   199 k
 policycoreutils            x86_64 2.0.83-29.el6       /policycoreutils-2.0.83-29.el6.x86_64                3.4 M
Installing for dependencies:
 libcgroup                  x86_64 0.40.rc1-17.el6_7   base                                                 129 k
 scl-utils                  x86_64 20120927-27.el6_6   base                                                  22 k
 t1lib                      x86_64 5.1.2-6.el6_2.1     base                                                 160 k
Updating for dependencies:
 libssh2                    x86_64 1.4.2-2.el6_7.1     base                                                 123 k

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

Total size: 37 M
Total download size: 435 k
Is this ok [y/N]: y
Console
Copy
... (생략)
Installed:
  audit-libs-python.x86_64 0:2.4.5-3.el6               environment-modules.x86_64 0:3.2.10-3.el6                 
  gd-last.x86_64 0:2.2.3-1.el6.remi                    libselinux-python.x86_64 0:2.0.94-7.el6                   
  libsemanage-python.x86_64 0:2.0.43-5.1.el6           libwebp.x86_64 0:0.4.3-3.el6                              
  libzip-last.x86_64 0:1.1.3-1.el6.remi                php56-php-cli.x86_64 0:5.6.25-1.el6.remi                  
  php56-php-common.x86_64 0:5.6.25-1.el6.remi          php56-php-devel.x86_64 0:5.6.25-1.el6.remi                
  php56-php-gd.x86_64 0:5.6.25-1.el6.remi              php56-php-mbstring.x86_64 0:5.6.25-1.el6.remi             
  php56-php-mcrypt.x86_64 0:5.6.25-1.el6.remi          php56-php-mysqlnd.x86_64 0:5.6.25-1.el6.remi              
  php56-php-pdo.x86_64 0:5.6.25-1.el6.remi             php56-php-pear.noarch 1:1.10.1-6.el6.remi                 
  php56-php-pecl-jsonc.x86_64 0:1.3.10-1.el6.remi      php56-php-pecl-jsonc-devel.x86_64 0:1.3.10-1.el6.remi     
  php56-php-pecl-ssh2.x86_64 0:0.13-1.el6.remi         php56-php-pecl-zip.x86_64 0:1.13.4-1.el6.remi             
  php56-php-pgsql.x86_64 0:5.6.25-1.el6.remi           php56-php-process.x86_64 0:5.6.25-1.el6.remi              
  php56-php-xml.x86_64 0:5.6.25-1.el6.remi             php56-php-xmlrpc.x86_64 0:5.6.25-1.el6.remi               
  php56-runtime.x86_64 0:2.1-5.el6.remi                policycoreutils-python.x86_64 0:2.0.83-29.el6             
  php56-php.x86_64 0:5.6.25-1.el6.remi                 setools-libs.x86_64 0:3.3.7-4.el6                    
  setools-libs-python.x86_64 0:3.3.7-4.el6                  

Dependency Installed:
  libcgroup.x86_64 0:0.40.rc1-17.el6_7   scl-utils.x86_64 0:20120927-27.el6_6   t1lib.x86_64 0:5.1.2-6.el6_2.1  

Updated:
  audit.x86_64 0:2.4.5-3.el6                              audit-libs.x86_64 0:2.4.5-3.el6                        
  libselinux.x86_64 0:2.0.94-7.el6                        libselinux-devel.x86_64 0:2.0.94-7.el6                 
  libselinux-utils.x86_64 0:2.0.94-7.el6                  libsemanage.x86_64 0:2.0.43-5.1.el6                    
  policycoreutils.x86_64 0:2.0.83-29.el6                 

Dependency Updated:
  libssh2.x86_64 0:1.4.2-2.el6_7.1                                                                                

Complete!

5 PHP CLI 교체[ | ]

Console
Copy
[root@zetawiki php56_rpms]# cd
[root@zetawiki ~]# php -v
PHP 5.3.3 (cli) (built: Oct 30 2014 20:12:53) 
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
[root@zetawiki ~]# /usr/bin/php56 -v
PHP 5.6.25 (cli) (built: Aug 31 2016 19:10:04) 
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
→ php 명령어는 여전히 5.3
Console
Copy
[root@zetawiki ~]# ll /usr/bin/ | grep php
-rwxr-xr-x    1 root root    3230416 Oct 31  2014 php
lrwxrwxrwx    1 root root         32 Sep  6 10:32 php56 -> /opt/remi/php56/root/usr/bin/php
lrwxrwxrwx    1 root root         36 Sep  6 10:32 php56-cgi -> /opt/remi/php56/root/usr/bin/php-cgi
lrwxrwxrwx    1 root root         33 Sep  6 10:32 php56-pear -> /opt/remi/php56/root/usr/bin/pear
lrwxrwxrwx    1 root root         38 Sep  6 10:32 php56-phar -> /opt/remi/php56/root/usr/bin/phar.phar
-rwxr-xr-x    1 root root    3243120 Oct 31  2014 php-cgi
-rwxr-xr-x    1 root root       4472 Oct 31  2014 php-config
-rwxr-xr-x    1 root root       4460 Oct 31  2014 phpize
Console
Copy
[root@zetawiki ~]# mv /usr/bin/php /usr/bin/php53
[root@zetawiki ~]# ln -s /opt/remi/php56/root/usr/bin/php /usr/bin/php
[root@zetawiki ~]# ll /usr/bin/ | grep php
lrwxrwxrwx    1 root root         32 Sep  6 11:10 php -> /opt/remi/php56/root/usr/bin/php
-rwxr-xr-x    1 root root    3230416 Oct 31  2014 php53
lrwxrwxrwx    1 root root         32 Sep  6 10:32 php56 -> /opt/remi/php56/root/usr/bin/php
lrwxrwxrwx    1 root root         36 Sep  6 10:32 php56-cgi -> /opt/remi/php56/root/usr/bin/php-cgi
lrwxrwxrwx    1 root root         33 Sep  6 10:32 php56-pear -> /opt/remi/php56/root/usr/bin/pear
lrwxrwxrwx    1 root root         38 Sep  6 10:32 php56-phar -> /opt/remi/php56/root/usr/bin/phar.phar
-rwxr-xr-x    1 root root    3243120 Oct 31  2014 php-cgi
-rwxr-xr-x    1 root root       4472 Oct 31  2014 php-config
-rwxr-xr-x    1 root root       4460 Oct 31  2014 phpize
Console
Copy
[root@zetawiki ~]# php -v
PHP 5.6.25 (cli) (built: Aug 31 2016 19:10:04) 
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies

6 아파치 연동[ | ]

Console
Copy
[root@zetawiki ~]# service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd: [Tue Sep 06 12:43:11 2016] [warn] module php5_module is already loaded, skipping
                                                           [  OK  ]
Console
Copy
[root@zetawiki ~]# apachectl -M | grep php
[Tue Sep 06 11:39:09 2016] [warn] module php5_module is already loaded, skipping
 php5_module (shared)
Syntax OK
→ 재시작하는데 php5_module 이 이미 로딩되었다고 나옴. php5_module 중복
Console
Copy
[root@zetawiki ~]# echo '<?php echo PHP_VERSION . PHP_EOL;' > /var/www/html/a.php
[root@zetawiki ~]# cat /var/www/html/a.php
<?php echo PHP_VERSION . PHP_EOL;
[root@zetawiki ~]# curl http://localhost/a.php
5.3.3
→ 아파치에 연동된 PHP 버전은 여전히 5.3
Console
Copy
[root@zetawiki ~]# ll /etc/httpd/conf.d/ | grep php
-rw-r--r-- 1 root root 1447 Sep  1 02:11 php56-php.conf
-rw-r--r-- 1 root root  674 Oct 31  2014 php.conf
→ php 설정파일이 2개 있음. 예전 것을 비활성화해야 함
Console
Copy
[root@zetawiki ~]# mv /etc/httpd/conf.d/php.conf /etc/httpd/conf.d/php.conf.old
[root@zetawiki ~]# apachectl -M | grep php
 php5_module (shared)
Syntax OK
[root@zetawiki ~]# service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]
[root@zetawiki ~]# curl http://localhost/a.php
5.6.25
→ 아파치에 PHP 5.6 버전이 연동되었음

7 (Optional) PEAR 교체[ | ]

Console
Copy
[root@zetawiki ~]# ll /usr/bin/ | grep pear
-rwxr-xr-x    1 root root        124 Dec  8  2011 pear
-rwxr-xr-x    1 root root        148 Dec  8  2011 peardev
lrwxrwxrwx    1 root root         33 Sep  6 10:32 php56-pear -> /opt/remi/php56/root/usr/bin/pear
Console
Copy
[root@zetawiki ~]# pear version
PEAR Version: 1.9.4
PHP Version: 5.6.25
Zend Engine Version: 2.6.0
Running on: Linux hub 2.6.32-431.11.2.el6.x86_64 #1 SMP Tue Mar 25 19:59:55 UTC 2014 x86_64
[root@zetawiki ~]# php56-pear version
PEAR Version: 1.10.1
PHP Version: 5.6.25
Zend Engine Version: 2.6.0
Running on: Linux hub 2.6.32-431.11.2.el6.x86_64 #1 SMP Tue Mar 25 19:59:55 UTC 2014 x86_64
Console
Copy
[root@zetawiki ~]# mv /usr/bin/pear /usr/bin/php53-pear
[root@zetawiki ~]# ln -s /opt/remi/php56/root/usr/bin/pear /usr/bin/pear
[root@zetawiki ~]# pear version
PEAR Version: 1.10.1
PHP Version: 5.6.25
Zend Engine Version: 2.6.0
Running on: Linux hub 2.6.32-431.11.2.el6.x86_64 #1 SMP Tue Mar 25 19:59:55 UTC 2014 x86_64

8 같이 보기[ | ]