프로그래밍/PHP

CENT OS 5 에서 php 5.4로 업데이트 하기

kugancity 2014. 7. 5. 15:25
반응형

 

json_encode($array, JSON_UNESCAPED_UNICODE) 를 사용하려고 했는데

PHP5.3은 JSON_UNESCAPED_UNICODE를 지원하지 않는다고 하여 php 버전을 업데이트 하기로 했다.

 

yum update php 를 해보았으나 아무 업데이트도 일어나지 않았다.

기본적으로 사용되는 저장소에 있는 php 버전이 낮아 자동으로 업데이트가 실행되지 않은 듯하다.  

 

yum에 추가적으로 사용할 만한 repository들을 검색하여 epel, remi, webtatic 저장소를 추가시켰다.

(참조:  http://lesstif.com/pages/viewpage.action?pageId=6979743)

 

 

 

 

yum repolist명령어로 새로운 저장소가 잘 추가되었는 지 확인하였다.

 

 

 

# yum repolist
repo id            repo name                                             status
addons             CentOS-5 - Addons                                           0
base               CentOS-5 - Base                                       3,654+8
epel               Extra Packages for Enterprise Linux 5 - x86_64          7,705
extras             CentOS-5 - Extras                                         265
updates            CentOS-5 - Updates                                     482+48
webtatic-el5       Webtatic Repository EL5 - x86_64                          135
repolist: 12,241

 

다른 저장소는 다 보이는데 remi가 리스트에 보이지 않는다.

이럴 경우에는   /etc/yum.repos.d/{repositoryname}.repo  를 열어서 enabled= 1 로 수정한다.

 

vi /etc/yum.repos.d/remi.repo

 

 

[remi]
name=Les RPM de remi pour Enterprise Linux 5 - $basearch
#baseurl=http://rpms.famillecollet.com/enterprise/5/remi/$basearch/
mirrorlist=http://rpms.famillecollet.com/enterprise/5/remi/mirror
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi

 

 

다시 yum repolist를 입력하면 아래와 같이 remi를 포함한 새로 추가된 세 개의 저장소가 모두 나타나는 것을 확인 할 수 있다.

 

# yum repolist
repo id                                                            repo name                                                                                              status
addons                                                             CentOS-5 - Addons                                                                                            0
base                                                               CentOS-5 - Base                                                                                        3,654+8
epel                                                               Extra Packages for Enterprise Linux 5 - x86_64                                                           7,705
extras                                                             CentOS-5 - Extras                                                                                          265
remi                                                               Les RPM de remi pour Enterprise Linux 5 - x86_64                                                         1,605
updates                                                            CentOS-5 - Updates                                                                                      482+48
webtatic-el5                                                       Webtatic Repository EL5 - x86_64                                                                           135
repolist: 13,846

 

 

각각의 저장소에서 가능한 php 정보를 확인해본다.

 

 

 # yum --enablerepo=remi info php
Installed Packages
Name       : php
Arch       : x86_64
Version    : 5.4.30
Release    : 1.el5.remi
Size       : 8.9 M
Repo       : installed
Summary    : PHP HTML-내장된 스크립트 언어. (PHP: Hypertext Preprocessor)
URL        : http://www.php.net/
License    : PHP and Zend and BSD
Description: PHP is an HTML-embedded scripting language. PHP attempts to make it
           : easy for developers to write dynamically generated webpages. PHP
           : also offers built-in database integration for several commercial
           : and non-commercial database management systems, so writing a
           : database-enabled webpage with PHP is fairly simple. The most common
           : use of PHP coding is probably as a replacement for CGI scripts.
           :
           : The php package contains the module which adds support for the PHP
           : language to Apache HTTP Server.

 

 

remi 저장소에 내가 찾던 5.4 버전이 있어 사용하기로 한다.  

--enablerepo=remi 옵션으로 사용할 저장소를 지정하고 php를 업데이트 한다.

#yum --enablerepo=remi update php


Dependency Installed:
  libXaw.x86_64 0:1.0.2-8.1
  libXmu.x86_64 0:1.0.2-5
  libXt.x86_64 0:1.0.2-3.2.el5
  libcurl.x86_64 0:7.21.7-5.el5.remi.2
  libedit.x86_64 0:2.11-2.20080712cvs.el5
  libssh2.x86_64 0:1.2.7-1.el5.remi
  mysql-libs.x86_64 0:5.5.38-1.el5.remi
  mysqlclient15.x86_64 0:5.0.67-1.el5.remi
  t1lib.x86_64 0:5.1.1-9.el5

Dependency Updated:
  mysql.i386 0:5.0.95-5.el5_9
  mysql.x86_64 0:5.5.38-1.el5.remi
  mysql-devel.i386 0:5.0.95-5.el5_9
  mysql-devel.x86_64 0:5.5.38-1.el5.remi
  mysql-server.x86_64 0:5.5.38-1.el5.remi

Replaced:
  php53.x86_64 0:5.3.3-22.el5_10        php53-cli.x86_64 0:5.3.3-22.el5_10
  php53-common.x86_64 0:5.3.3-22.el5_10 php53-devel.x86_64 0:5.3.3-22.el5_10
  php53-gd.x86_64 0:5.3.3-22.el5_10     php53-mbstring.x86_64 0:5.3.3-22.el5_10
  php53-mysql.x86_64 0:5.3.3-22.el5_10  php53-pdo.x86_64 0:5.3.3-22.el5_10

Complete!

 

 

업데이트가 끝난후 service httpd restart 로 웹서버 재구동하고 php -v 로 제대로 업데이트가 완료 된 것을 확인한다.

 

# php -v
PHP 5.4.30 (cli) (built: Jun 25 2014 15:41:34)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies


 

728x90
반응형