mysqlとphp-fpmとnginxと

14.04LTSから16.04LTSへのアップグレード失敗したみたいw
どうやら

# do-release-upgrade -d

で上げたら、ぼくの環境だとmysqlのアップグレード時に止まってしまった。。

# cat /var/log/dist-upgrade/history.log

Error: Sub-process /usr/bin/dpkg returned an error code (1)
End-Date: 2016-04-22  22:39:44

さてどうしたもんかと
まぁ普通にやってみましょうかw

一旦、ロックファイルを削除して
再度、apt-getをかけてみる。

# rm /var/lib/apt/lists/lock
# rm /var/lib/dpkg/lock
# apt-get update
# dkpg 
# apt-get upgrade
#
Do you want to continue? [Y/n] y
Setting up mysql-server-5.7 (5.7.11-0ubuntu6) ...
mysql stop/waiting
dpkg: error processing package mysql-server-5.7 (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
 mysql-server depends on mysql-server-5.7; however:
  Package mysql-server-5.7 is not configured yet.

dpkg: error processing package mysql-server (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 mysql-server-5.7
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

やばいっすwww
mysqlがアップグレード出来ない。。。

仕方ないので、バックアップを取ってから
パッケージごと削除してやる

# mkdir /opt/sql
# cp -r /var/lib/mysql /opt/sql
# apt-get purge mysql*
# apt-get autoremove
# apt-get autoclean
#
# apt-get install mysql-server php-mysql
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  cpp-4.8 gcc-4.8 libasan0 libcloog-isl4 libcroco3 libgcc-4.8-dev
  libgdk-pixbuf2.0-0 libgdk-pixbuf2.0-common libilmbase6 libisl10 libjasper1
  liblinear1 libmagickcore5 libmagickcore5-extra libmagickwand5 libopenexr6
  librsvg2-2 librsvg2-common libvpx1 linux-headers-3.13.0-85
  linux-headers-3.13.0-85-generic linux-image-3.13.0-85-generic
  linux-image-3.16.0-67-generic linux-image-extra-3.13.0-85-generic
  linux-image-extra-3.16.0-67-generic python-requests python-urllib3
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  libaio1 libcgi-fast-perl libcgi-pm-perl libencode-locale-perl libfcgi-perl
  libhtml-parser-perl libhtml-tagset-perl libhtml-template-perl
  libhttp-date-perl libhttp-message-perl libio-html-perl
  liblwp-mediatypes-perl libtimedate-perl liburi-perl mysql-client-5.7
  mysql-client-core-5.7 mysql-common mysql-server-5.7 mysql-server-core-5.7
Suggested packages:
  libdata-dump-perl libipc-sharedcache-perl libwww-perl mailx tinyca
The following NEW packages will be installed:
  libaio1 libcgi-fast-perl libcgi-pm-perl libencode-locale-perl libfcgi-perl
  libhtml-parser-perl libhtml-tagset-perl libhtml-template-perl
  libhttp-date-perl libhttp-message-perl libio-html-perl
  liblwp-mediatypes-perl libtimedate-perl liburi-perl mysql-client-5.7
  mysql-client-core-5.7 mysql-common mysql-server mysql-server-5.7
  mysql-server-core-5.7
0 upgraded, 20 newly installed, 0 to remove and 1 not upgraded.
Need to get 0 B/18.6 MB of archives.
After this operation, 162 MB of additional disk space will be used.
Do you want to continue? [Y/n]

上手く入ったようです。

今度はPHP-FPMが動かない。

# dpkg -l |grep php5-fpm
rc  php5-fpm                            5.5.9+dfsg-1ubuntu4.16              amd64        server-side, HTML-embedded scripting language (FPM-CGI binary)

消した記憶はないがRCフラグが立ってる。。。

しょうがないので再インストールする。

# apt-cache search php-fpm
php-cgi - server-side, HTML-embedded scripting language (CGI binary) (default)
php-fpm - server-side, HTML-embedded scripting language (FPM-CGI binary) (default)
php7.0-fpm - server-side, HTML-embedded scripting language (FPM-CGI binary)
# 
# apt-get install php-fpm

php7.0-fpmがはいるんだな。。

ソケットはここに移動したらしい。

# ls /var/run/php/
php7.0-fpm.pid  php7.0-fpm.sock

移動するなや!!

ということでソケットを
nginxのconfに以下を設定

# 
        location ~ \.php$ {
                include /etc/nginx/fastcgi_params;
                fastcgi_pass    unix:/var/run/php/php7.0-fpm.sock;
                fastcgi_index   index.php;
                fastcgi_param   SCRIPT_FILENAME $document_root	$fastcgi_script_name;

こんな感じ

あとは残ったphp5-fpmを削除

# dpkg --purge php5-fpm
(Reading database ... 117555 files and directories currently installed.)
Removing php5-fpm (5.5.9+dfsg-1ubuntu4.16) ...
Purging configuration files for php5-fpm (5.5.9+dfsg-1ubuntu4.16) ...

ほかにもPHP5系があるかチェックして削除

# apt-get purge php5*
#
The following packages will be REMOVED:
  php-apc* php5-apcu* php5-common* php5-gd* php5-json*
#

とのことなので、削除してapcとgdは入れ直し

一応、調べておく

# apt-cache search php-apc
php-apcu - APC User Cache for PHP
#
# apt-cache search php-gd
php-gd - GD module for PHP [default]
php7.0-gd - GD module for PHP
#
# apt-cache show php-apcu
Package: php-apcu
Priority: optional
Section: universe/php
Installed-Size: 216
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Debian PHP PECL Maintainers <pkg-php-pecl@lists.alioth.debian.org>
Architecture: amd64
Version: 5.1.3+4.0.10-1build1
Replaces: php-user-cache
Provides: php-user-cache
Depends: php-common (>= 1:7.0+33~), phpapi-20151012, libc6 (>= 2.14)
Recommends: php-apcu-bc
Suggests: php-gd
Conflicts: php-user-cache, php-xcache, php-yac
Filename: pool/universe/p/php-apcu/php-apcu_5.1.3+4.0.10-1build1_amd64.deb
Size: 63976
MD5sum: 33d3203cb131758c9e9e3dd20f25acf5
SHA1: b43059ea7a538d4b735fe82369857961e0ac6943
SHA256: c2f7ecedacec116ad0a5ff986ddda1d1ea2a23aaab97dba4ba438c5e6ce3b64c
Description-en: APC User Cache for PHP
 The APCu is userland caching: APC (Alternative PHP Cache) stripped of
 opcode caching after the deployment of Zend OpCache in PHP 5.5 as the
 primary solution to opcode caching in future versions of PHP.
 .
 The APCu is a fast solution for userland caching (and dumping) of PHP
 variables locally, it is not distributed like MemcacheD, but they can
 be used together for optimal caching.
Description-md5: 0d7462c8f566c71b65f0d4bcf7806445
Homepage: http://pecl.php.net/package/APCu
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Origin: Ubuntu
#

やぱり7.0系がはいる模様。。

さて分かったので、いれる。

# apt-get install php-apcu php-gd
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  php7.0-gd
Recommended packages:
  php-apcu-bc
The following NEW packages will be installed:
  php-apcu php-gd php7.0-gd
#

これで落ち着いたかな。。。

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

Enter code * Time limit is exhausted. Please reload CAPTCHA.

This site uses Akismet to reduce spam. Learn how your comment data is processed.