우분투14 PHP 5.5 → 5.6 업그레이드

우분투14 PHP 5.5 → 5.6 업그레이드
우분투14 PHP 5.5.9 → 5.6 업그레이드

1 확인[ | ]

root@zeta:~# php -v
PHP 5.5.9-1ubuntu4.21 (cli) (built: Feb  9 2017 20:54:58) 
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
    with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies
root@zeta:~# apt-get -s install php5
Reading package lists... Done
Building dependency tree       
Reading state information... Done
php5 is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 24 not upgraded.

2 사전작업[ | ]

3 APT저장소 추가[ | ]

root@zeta:~# add-apt-repository ppa:ondrej/php
 Co-installable PHP versions: PHP 5.6, PHP 7.0, PHP 7.1 and most requested extensions are included.

PLEASE DON'T USE PHP 5.4 OR PHP 5.5. The PHP 5.5 and later are no longer supported with security updates, therefore they are not included in this repository.

You can get more information about the packages at https://deb.sury.org

BUGS&FEATURES: This PPA now has a issue tracker: https://deb.sury.org/#bug-reporting

PLEASE READ: If you like my work and want to give me a little motivation, please consider donating regularly: https://donate.sury.org/

WARNING: add-apt-repository is broken with non-UTF-8 locales, see https://github.com/oerdnj/deb.sury.org/issues/56 for workaround:

# LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
 More info: https://launchpad.net/~ondrej/+archive/ubuntu/php
Press [ENTER] to continue or ctrl-c to cancel adding it
gpg: keyring `/tmp/tmphc30ttb8/secring.gpg' created
gpg: keyring `/tmp/tmphc30ttb8/pubring.gpg' created
gpg: requesting key E5267A6C from hkp server keyserver.ubuntu.com
gpg: /tmp/tmphc30ttb8/trustdb.gpg: trustdb created
gpg: key E5267A6C: public key "Launchpad PPA for Ondřej Surý" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
OK
→ 중간에 WARNING이 있긴 한데, 별일 아니라서 무시했음

4 apt-get update[ | ]

root@zeta:~# apt-get update
... (생략)
Ign http://us.archive.ubuntu.com trusty/restricted Translation-en_US           
Ign http://us.archive.ubuntu.com trusty/universe Translation-en_US             
Fetched 6,101 kB in 18s (322 kB/s)                                             
Reading package lists... Done

5 기존 패키지 확인[ | ]

root@zeta:~# dpkg -l | grep php5 | awk '{print $2}'
php5
php5-cgi
php5-cli
php5-common
php5-curl
php5-dev
php5-gd
php5-json
php5-memcached
php5-mysql
php5-readline
root@zeta:~# dpkg -l | grep php5 | awk '{print $2}' | sed 's/php5/php5.6/g' | xargs echo
libapache2-mod-php5.6 php5.6 php5.6-cgi php5.6-cli php5.6-common php5.6-curl php5.6-dev php5.6-gd php5.6-json php5.6-memcached php5.6-mysql php5.6-readline

6 설치[ | ]

  • php5-xxx에 대응하는 php5.6-xxx를 모두 설치하려고 했는데, php5.6-memcached는 없는 모양. 별 문제 없을 것으로 판단하고 설치 진행
root@zeta:~# apt-get install libapache2-mod-php5.6 php5.6 php5.6-cgi php5.6-cli php5.6-common php5.6-curl php5.6-dev php5.6-gd php5.6-json php5.6-memcached php5.6-mysql php5.6-readline
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'php-memcached' instead of 'php5.6-memcached'
The following package was automatically installed and is no longer required:
  libvpx1
Use 'apt-get autoremove' to remove it.
The following extra packages will be installed:
  apache2 apache2-bin apache2-data dh-php libaprutil1-dbd-sqlite3
  libaprutil1-ldap libgd3 liblist-moreutils-perl libmemcached11 libssl1.0.2
  libwebp5 php-common php-igbinary php-msgpack php5.6-opcache ssl-cert xml2
Suggested packages:
  apache2-doc apache2-suexec-pristine apache2-suexec-custom apache2-utils
  libgd-tools openssl-blacklist
The following NEW packages will be installed:
  apache2 apache2-bin apache2-data dh-php libapache2-mod-php5.6
  libaprutil1-dbd-sqlite3 libaprutil1-ldap liblist-moreutils-perl
  libmemcached11 libssl1.0.2 php-common php-igbinary php-memcached php-msgpack
  php5.6 php5.6-cgi php5.6-cli php5.6-common php5.6-curl php5.6-dev php5.6-gd
  php5.6-json php5.6-mysql php5.6-opcache php5.6-readline ssl-cert xml2
The following packages will be upgraded:
  libgd3 libwebp5
2 upgraded, 27 newly installed, 0 to remove and 36 not upgraded.
Need to get 9,442 kB/10.5 MB of archives.
After this operation, 40.6 MB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 http://us.archive.ubuntu.com/ubuntu/ trusty/main libaprutil1-dbd-sqlite3 amd64 1.5.3-1 [10.5 kB]
Get:2 http://ppa.launchpad.net/ondrej/php/ubuntu/ trusty/main libssl1.0.2 amd64 1.0.2k-1+deb.sury.org~trusty+5 [1,270 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu/ trusty/main libaprutil1-ldap amd64 1.5.3-1 [8,634 B]
... (생략)
Setting up apache2 (2.4.7-1ubuntu4.15) ...
 * Restarting web server apache2                                                      [fail] 
 * The apache2 configtest failed.
Output of config test was:
apache2: Syntax error on line 142 of /etc/apache2/apache2.conf: Syntax error on line 1 of /etc/apache2/mods-enabled/php5.load: Cannot load /usr/lib/apache2/modules/libphp5.so into server: /usr/lib/apache2/modules/libphp5.so: cannot open shared object file: No such file or directory
Action 'configtest' failed.
The Apache error log may have more information.
invoke-rc.d: initscript apache2, action "restart" failed.
Setting up php-common (1:52+deb.sury.org~trusty+1) ...
Setting up php5.6-common (5.6.30-10+deb.sury.org~trusty+2) ...

Creating config file /etc/php/5.6/mods-available/calendar.ini with new version
... (생략)
Setting up xml2 (0.4-3.1) ...
Setting up dh-php (0.27+deb.sury.org~trusty+1) ...
Processing triggers for libc-bin (2.19-0ubuntu6.11) ...
Processing triggers for libapache2-mod-php5.6 (5.6.30-10+deb.sury.org~trusty+2) ...
→ 중간에 아파치 재기동 실패... ㅠㅠ

7 아파치 오류 후속조치[ | ]

root@zeta:~# service apache2 restart
 * Restarting web server apache2                                                      [fail] 
 * The apache2 configtest failed.
Output of config test was:
apache2: Syntax error on line 142 of /etc/apache2/apache2.conf: Syntax error on line 1 of /etc/apache2/mods-enabled/php5.load: Cannot load /usr/lib/apache2/modules/libphp5.so into server: /usr/lib/apache2/modules/libphp5.so: cannot open shared object file: No such file or directory
Action 'configtest' failed.
The Apache error log may have more information.
root@zeta:~# cat /etc/apache2/mods-enabled/php5.load
LoadModule php5_module /usr/lib/apache2/modules/libphp5.so
root@zeta:~# ll /usr/lib/apache2/modules/ | grep libphp
-rw-r--r-- 1 root root 4338504 Apr 12 17:06 libphp5.6.so
→ php5.load 파일 내용 중 libphp5.so 이 libphp5.6.so으로 바뀌어야 함
root@zeta:~# sed -i 's/libphp5.so/libphp5.6.so/' /etc/apache2/mods-enabled/php5.load
root@zeta:~# cat /etc/apache2/mods-enabled/php5.load
LoadModule php5_module /usr/lib/apache2/modules/libphp5.6.so
root@zeta:~# service apache2 restart
 * Restarting web server apache2                                                      [ OK ]

8 확인 2[ | ]

root@zeta:~# php -v
PHP 5.6.30-10+deb.sury.org~trusty+2 (cli) 
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies

9 같이 보기[ | ]

10 참고[ | ]

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