CentOS 6에 PHP 5.6 설치 (yum webtatic)

Jmnote bot (토론 | 기여)님의 2015년 2월 6일 (금) 02:11 판 (로봇: 자동으로 텍스트 교체 (-<source lang='dos'> +<source lang='cli'>))

1 개요

CentOS 6에 PHP 5.6 설치 (yum)
  • beta 버전 rpm을 사용... 중요한 시스템이라면 영향도를 충분히 고려하시라.
  • PHP 패키지들의 기초라 할 수 있는 php-common을 교체하는 과정이 포함되어 있음[1]

2 확인

[root@jmnote ~]# php -v | head -1
PHP 5.3.3 (cli) (built: Dec 11 2013 03:29:57)
[root@jmnote ~]# rpm -qa | grep ^php
php-common-5.3.3-27.el6_5.x86_64
php-mysql-5.3.3-27.el6_5.x86_64
php-cli-5.3.3-27.el6_5.x86_64
php-devel-5.3.3-27.el6_5.x86_64
php-5.3.3-27.el6_5.x86_64
php-xml-5.3.3-27.el6_5.x86_64
php-pear-1.9.4-4.el6.noarch
php-pdo-5.3.3-27.el6_5.x86_64
php-gd-5.3.3-27.el6_5.x86_64
php-intl-5.3.3-27.el6_5.x86_64

3 webtatic 저장소 추가

4 설치 시도 (오류)

[root@jmnote ~]# yum install --enablerepo=webtatic-testing php56w php56w-opcache
... (생략)
Error: php56w-common conflicts with php-common-5.3.3-27.el6_5.x86_64
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

5 yum-plugin-replace 설치

[root@jmnote ~]# yum install yum-plugin-replace
... (생략)
========================================================================
 Package               Arch      Version              Repository   Size
========================================================================
Installing:
 yum-plugin-replace    noarch    0.2.6-1.ius.el6      webtatic     17 k

Transaction Summary
========================================================================
Install       1 Package(s)

Total download size: 17 k
Installed size: 34 k
Is this ok [y/N]: y
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-webtatic-andy
Importing GPG key 0xCF4C4FF9:
 Userid : Andy Thompson <andy@webtatic.com>
 Package: webtatic-release-6-4.noarch (installed)
 From   : /etc/pki/rpm-gpg/RPM-GPG-KEY-webtatic-andy
Is this ok [y/N]: y
... (생략)
Installed:
  yum-plugin-replace.noarch 0:0.2.6-1.ius.el6                           

Complete!

6 php-common 교체

[root@jmnote ~]# yum replace --enablerepo=webtatic-testing php-common --replace-with=php56w-common
... (생략)
WARNING: Unable to resolve all providers: ['config(php-common)', 'curl.so()(64bit)', 'fileinfo.so()(64bit)', 'json.so()(64bit)', 'phar.so()(64bit)', 'zip.so()(64bit)', 'config(php)', 'libphp5.so()(64bit)', 'config(php-pdo)', 'pdo.so()(64bit)', 'pdo_sqlite.so()(64bit)', 'sqlite3.so()(64bit)', 'config(php-gd)', 'gd.so()(64bit)', 'config(php-mysql)', 'mysql.so()(64bit)', 'mysqli.so()(64bit)', 'pdo_mysql.so()(64bit)', 'config(php-devel)', 'config(php-xml)', 'dom.so()(64bit)', 'wddx.so()(64bit)', 'xmlreader.so()(64bit)', 'xmlwriter.so()(64bit)', 'xsl.so()(64bit)', 'config(php-intl)', 'intl.so()(64bit)']

This may be normal depending on the package.  Continue? [y/N] y
... (생략)
========================================================================
 Package         Arch    Version                Repository         Size
========================================================================
Installing:
 php56w          x86_64  5.6.0-0.7.beta4.w6     webtatic-testing  2.5 M
 php56w-cli      x86_64  5.6.0-0.7.beta4.w6     webtatic-testing  2.4 M
 php56w-common   x86_64  5.6.0-0.7.beta4.w6     webtatic-testing  1.1 M
 php56w-devel    x86_64  5.6.0-0.7.beta4.w6     webtatic-testing  2.5 M
 php56w-gd       x86_64  5.6.0-0.7.beta4.w6     webtatic-testing  140 k
 php56w-intl     x86_64  5.6.0-0.7.beta4.w6     webtatic-testing  175 k
 php56w-mysql    x86_64  5.6.0-0.7.beta4.w6     webtatic-testing  107 k
 php56w-pdo      x86_64  5.6.0-0.7.beta4.w6     webtatic-testing   92 k
 php56w-pear     noarch  1:1.9.4-1.w6           webtatic-testing  363 k
 php56w-xml      x86_64  5.6.0-0.7.beta4.w6     webtatic-testing  143 k
Removing:
 php             x86_64  5.3.3-27.el6_5         @updates          3.5 M
 php-cli         x86_64  5.3.3-27.el6_5         @updates          6.2 M
 php-common      x86_64  5.3.3-27.el6_5         @updates          2.9 M
 php-devel       x86_64  5.3.3-27.el6_5         @updates          3.0 M
 php-gd          x86_64  5.3.3-27.el6_5         @updates          324 k
 php-intl        x86_64  5.3.3-27.el6_5         @updates          166 k
 php-mysql       x86_64  5.3.3-27.el6_5         @updates          216 k
 php-pdo         x86_64  5.3.3-27.el6_5         @updates          168 k
 php-pear        noarch  1:1.9.4-4.el6          @base             2.2 M
 php-xml         x86_64  5.3.3-27.el6_5         @updates          307 k
Installing for dependencies:
 php56w-process  x86_64  5.6.0-0.7.beta4.w6     webtatic-testing   32 k
 t1lib           x86_64  5.1.2-6.el6_2.1        base              160 k

Transaction Summary
========================================================================
Install      12 Package(s)
Remove       10 Package(s)

Total download size: 9.7 M
Is this ok [y/N]: y
... (생략)
Installed:
  php56w.x86_64 0:5.6.0-0.7.beta4.w6                                    
  php56w-cli.x86_64 0:5.6.0-0.7.beta4.w6                                
  php56w-common.x86_64 0:5.6.0-0.7.beta4.w6                             
  php56w-devel.x86_64 0:5.6.0-0.7.beta4.w6                              
  php56w-gd.x86_64 0:5.6.0-0.7.beta4.w6                                 
  php56w-intl.x86_64 0:5.6.0-0.7.beta4.w6                               
  php56w-mysql.x86_64 0:5.6.0-0.7.beta4.w6                              
  php56w-pdo.x86_64 0:5.6.0-0.7.beta4.w6                                
  php56w-pear.noarch 1:1.9.4-1.w6                                       
  php56w-xml.x86_64 0:5.6.0-0.7.beta4.w6                                

Dependency Installed:
  php56w-process.x86_64 0:5.6.0-0.7.beta4.w6                            
  t1lib.x86_64 0:5.1.2-6.el6_2.1                                        

Complete!

7 확인 2

[root@jmnote ~]# php -v
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/apc.so' - /usr/lib64/php/modules/apc.so: undefined symbol: zend_unmangle_property_name in Unknown on line 0
PHP 5.6.0beta4 (cli) (built: Jun  7 2014 19:18:41) 
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.6.0-dev, Copyright (c) 1998-2014 Zend Technologies
APC 모듈을 적재하는 과정에서 Warning 발생
→ (이것은 필자가 APC 모듈이 설정했기 때문에 발생하는 것이다. 만약 설정되지 않았다면 뜨지 않을 것이다.)
→ PHP 5.6.0beta4 버전임

8 php56w-opcache 설치

[root@jmnote ~]# yum install --enablerepo=webtatic-testing php56w-opcache
... (생략)
========================================================================
 Package         Arch    Version                Repository         Size
========================================================================
Installing:
 php56w-opcache  x86_64  5.6.0-0.7.beta4.w6     webtatic-testing   97 k

Transaction Summary
========================================================================
Install       1 Package(s)

Total download size: 97 k
Installed size: 292 k
Is this ok [y/N]: y
... (생략)
Installed:
  php56w-opcache.x86_64 0:5.6.0-0.7.beta4.w6                            

Complete!

9 확인 3

[root@jmnote ~]# php -v
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/apc.so' - /usr/lib64/php/modules/apc.so: undefined symbol: zend_unmangle_property_name in Unknown on line 0
PHP 5.6.0beta4 (cli) (built: Jun  7 2014 19:18:41) 
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.6.0-dev, Copyright (c) 1998-2014 Zend Technologies
    with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2014, by Zend Technologies
→ APC 모듈 Warning은 그대로 발생
→ Zend OPcache가 추가됨

10 아파치 재시작

  • 아파치에 적용하기 위해 아파치를 재시작
[root@jmnote ~]# service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]
  • 일반적인 경우(APC 설정을 하지 않은 경우)라면 여기까지 하면 OK

11 (APC 모듈 비활성화 조치)

  • APC 모듈 Warning을 없애기 위해 비활성화한다.
[root@jmnote ~]# vi /etc/php.ini
;[apc]
;extension=apc.so
→ apc 모듈 설정 부분을 주석처리함
[root@jmnote ~]# php -v
PHP 5.6.0beta4 (cli) (built: Jun  7 2014 19:18:41) 
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.6.0-dev, Copyright (c) 1998-2014 Zend Technologies
    with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2014, by Zend Technologies
→ APC 모듈 Warning이 사라짐

12 (미디어위키 APC 설정 제거 조치)

  • 미디어위키 웹페이지에서 아래와 같은 오류 발생
[54c0a219] /w/ Exception from line 133 of /var/www/html/w/includes/objectcache/ObjectCache.php: CACHE_ACCEL requested but no suitable object cache is present. You may want to install APC.

Backtrace:

#0 [internal function]: ObjectCache::newAccelerator(array)
#1 /var/www/html/w/includes/objectcache/ObjectCache.php(85): call_user_func(string, array)
#2 /var/www/html/w/includes/objectcache/ObjectCache.php(72): ObjectCache::newFromParams(array)
#3 /var/www/html/w/includes/objectcache/ObjectCache.php(44): ObjectCache::newFromId(integer)
#4 /var/www/html/w/includes/GlobalFunctions.php(3961): ObjectCache::getInstance(integer)
#5 /var/www/html/w/includes/Setup.php(513): wfGetMainCache()
#6 /var/www/html/w/includes/WebStart.php(156): require_once(string)
#7 /var/www/html/w/index.php(43): require(string)
#8 {main}
[root@jmnote ~]# vi /var/www/html/w/LocalSettings.php
## Shared memory settings
#$wgMainCacheType = CACHE_ACCEL;
#$wgMemCachedServers = array();
→ 캐시 설정부분을 주석처리함
→ 여기까지 하니 미디어위키 웹페이지가 정상화되었다.

13 (원상복구)

  • 아래 명령어로 간단하게 원래 상태로 복구할 수 있다.
즉 PHP 5.6 → 5.3.3
yum remove php56w-opcache
yum replace php56w-common --replace-with=php-common

14 같이 보기

15 주석

  1. 다른 모든 PHP 패키지가 여기에 의존성이 있음

16 참고 자료