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

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

1 사전 작업[ | ]

2 현재 버전 확인[ | ]

[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 ~]# rpm -qa | grep php
php-cli-5.3.3-23.el6_4.x86_64
php-xml-5.3.3-23.el6_4.x86_64
php-5.3.3-23.el6_4.x86_64
php-common-5.3.3-23.el6_4.x86_64
php-gd-5.3.3-23.el6_4.x86_64
php-pear-1.9.4-4.el6.noarch
php-pdo-5.3.3-23.el6_4.x86_64
→ PHP 5.3이 설치되어 있음

3 신규 버전 확인[ | ]

[root@zetawiki ~]# yum list | grep php56 | egrep 'php-cli|php-xml|php-common|php-gd|php-pear|php-pdo'
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-gd.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-xml.x86_64                       5.6.25-1.el6.remi           remi-safe
php56-php-xmlrpc.x86_64                    5.6.25-1.el6.remi           remi-safe
→ 기존 패키지에 대응되는 패키지가 모두 있음
  • 패키지 목록을 변수($PACKAGES)에 담고 확인
[root@zetawiki ~]# PACKAGES=`yum list | grep php56 | egrep 'php-cli|php-xml|php-common|php-gd|php-pear|php-pdo' | awk '{print $1}'`
[root@zetawiki ~]# echo $PACKAGES
php56-php-cli.x86_64 php56-php-common.x86_64 php56-php-gd.x86_64 php56-php-pdo.x86_64 php56-php-pear.noarch php56-php-xml.x86_64 php56-php-xmlrpc.x86_64

4 yum 설치[ | ]

[root@zetawiki ~]# yum install php56-php $PACKAGES
... (생략)
===========================================================================================
 Package                      Arch         Version                   Repository       Size
===========================================================================================
Installing:
 php56-php                    x86_64       5.6.25-1.el6.remi         remi-safe       1.4 M
 php56-php-cli                x86_64       5.6.25-1.el6.remi         remi-safe       2.6 M
 php56-php-common             x86_64       5.6.25-1.el6.remi         remi-safe       691 k
 php56-php-gd                 x86_64       5.6.25-1.el6.remi         remi-safe        65 k
 php56-php-pdo                x86_64       5.6.25-1.el6.remi         remi-safe        90 k
 php56-php-pear               noarch       1:1.10.1-6.el6.remi       remi-safe       366 k
 php56-php-xml                x86_64       5.6.25-1.el6.remi         remi-safe       147 k
 php56-php-xmlrpc             x86_64       5.6.25-1.el6.remi         remi-safe        66 k
Installing for dependencies:
 audit-libs-python            x86_64       2.4.5-3.el6               base             63 k
 environment-modules          x86_64       3.2.10-3.el6              base            103 k
 gd-last                      x86_64       2.2.3-1.el6.remi          remi-safe       126 k
 libcgroup                    x86_64       0.40.rc1-18.el6_8         updates         130 k
 libsemanage-python           x86_64       2.0.43-5.1.el6            base             81 k
 libwebp                      x86_64       0.4.3-3.el6               epel            210 k
 libzip-last                  x86_64       1.1.3-1.el6.remi          remi-safe        42 k
 php56-php-pecl-jsonc         x86_64       1.3.10-1.el6.remi         remi-safe        42 k
 php56-php-pecl-zip           x86_64       1.13.4-1.el6.remi         remi-safe        40 k
 php56-php-process            x86_64       5.6.25-1.el6.remi         remi-safe        55 k
 php56-runtime                x86_64       2.1-5.el6.remi            remi-safe       1.0 M
 policycoreutils-python       x86_64       2.0.83-29.el6             base            437 k
 scl-utils                    x86_64       20120927-27.el6_6         base             22 k
 setools-libs                 x86_64       3.3.7-4.el6               base            400 k
 setools-libs-python          x86_64       3.3.7-4.el6               base            222 k
 t1lib                        x86_64       5.1.2-6.el6_2.1           base            160 k
 tcl                          x86_64       1:8.5.7-6.el6             base            1.9 M
Updating for dependencies:
 audit                        x86_64       2.4.5-3.el6               base            214 k
 audit-libs                   x86_64       2.4.5-3.el6               base             74 k
 libsemanage                  x86_64       2.0.43-5.1.el6            base            104 k
 policycoreutils              x86_64       2.0.83-29.el6             base            663 k

Transaction Summary
===========================================================================================
Install      25 Package(s)
Upgrade       4 Package(s)

Total download size: 11 M
Is this ok [y/N]: y
... (생략)
Installed:
  php56-php.x86_64 0:5.6.25-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-gd.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-xml.x86_64 0:5.6.25-1.el6.remi     php56-php-xmlrpc.x86_64 0:5.6.25-1.el6.remi 

Dependency 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                                                        
  libcgroup.x86_64 0:0.40.rc1-18.el6_8                                                     
  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-pecl-jsonc.x86_64 0:1.3.10-1.el6.remi                                          
  php56-php-pecl-zip.x86_64 0:1.13.4-1.el6.remi                                            
  php56-php-process.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                                            
  scl-utils.x86_64 0:20120927-27.el6_6                                                     
  setools-libs.x86_64 0:3.3.7-4.el6                                                        
  setools-libs-python.x86_64 0:3.3.7-4.el6                                                 
  t1lib.x86_64 0:5.1.2-6.el6_2.1                                                           
  tcl.x86_64 1:8.5.7-6.el6                                                                 

Dependency Updated:
  audit.x86_64 0:2.4.5-3.el6                 audit-libs.x86_64 0:2.4.5-3.el6              
  libsemanage.x86_64 0:2.0.43-5.1.el6        policycoreutils.x86_64 0:2.0.83-29.el6       

Complete!

5 PHP CLI 교체[ | ]

[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
[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
[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
[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 아파치 연동[ | ]

[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  ]
[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 중복
[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
[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개 있음. 예전 것을 비활성화해야 함
[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 교체[ | ]

[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
[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
[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 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}