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

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

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 software-properties-common 설치[ | ]

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}' | xargs echo
libapache2-mod-php5 php5 php5-apcu php5-cli php5-common php5-curl php5-dev php5-json php5-mysql php5-readline
root@zeta:~# dpkg -l | grep php5 | awk '{print $2}' | sed 's/php5/php7.0/g' | xargs echo
libapache2-mod-php7.0 php7.0 php7.0-apcu php7.0-cli php7.0-common php7.0-curl php7.0-dev php7.0-json php7.0-mysql php7.0-readline

6 설치[ | ]

  • php5-xxx에 대응하는 php7.0-xxx를 모두 설치하려고 했는데, php7.0-memcached는 없는 모양. 별 문제 없을 것으로 판단하고 설치 진행
root@zeta:~# apt-get install libapache2-mod-php7.0 php7.0 php7.0-apcu php7.0-cli php7.0-common php7.0-curl php7.0-dev php7.0-json php7.0-mysql php7.0-readline
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'php-apcu' instead of 'php7.0-apcu'
The following extra packages will be installed:
  dh-php liblist-moreutils-perl libssl1.0.2 php-apcu-bc php-common
  php7.0-opcache xml2
Suggested packages:
  php-gd
The following NEW packages will be installed:
  dh-php libapache2-mod-php7.0 liblist-moreutils-perl libssl1.0.2 php-apcu
  php-apcu-bc php-common php7.0 php7.0-cli php7.0-common php7.0-curl
  php7.0-dev php7.0-json php7.0-mysql php7.0-opcache php7.0-readline xml2
0 upgraded, 17 newly installed, 0 to remove and 193 not upgraded.
Need to get 5,604 kB of archives.
After this operation, 24.2 MB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 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:2 http://us.archive.ubuntu.com/ubuntu/ trusty/main liblist-moreutils-perl amd64 0.33-1build3 [48.5 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu/ trusty/universe xml2 amd64 0.4-3.1 [15.8 kB]
... (생략)
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
... (생략)
Creating config file /etc/php/7.0/mods-available/mysqli.ini with new version

Creating config file /etc/php/7.0/mods-available/pdo_mysql.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.7) ...
Processing triggers for libapache2-mod-php7.0 (7.0.19-1+deb.sury.org~trusty+1) ...

7 확인 2[ | ]

root@zeta:~# php -v
PHP 7.0.19-1+deb.sury.org~trusty+1 (cli) (built: May 11 2017 14:29:27) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.0.19-1+deb.sury.org~trusty+1, Copyright (c) 1999-2017, by Zend Technologies

8 (Optional) 아파치 재시작[ | ]

root@zeta:~# service apache2 restart
 * Restarting web server apache2                                                      [ OK ]

9 같이 보기[ | ]

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