メンテナンス・トラブルシュート - pkg・ports アップデート関連 - WordPress 4.4.1_1 から 4.4.2_1 アップデート時にエラー

 
 この稿。結局のところ、最後の項まで読まないと失敗しますので・・・。
1. 発端
2. package でアップデート
3. 再度 portupgrade
4. 後日談(重要!!!)

1. 能書き

 2016年2月24日に発生した出来事です。  WordPress が ports に反映されるのは、いささか時間がかかります。2週間程度の時間差でしょうか。  ここのところ WordPress のダッシュボードに更新情報が書かれているのですが、わたしは ports からの更新を待っていました。  で上記の日に更新があったのです。

> pkg version -vl "<"
ja-wordpress-4.4.1_1               <   needs updating (index has 4.4.2_1)
 喜んで更新しようとしましたらば

> portupgrade -vRr ja-wordpress
--->  Session started at: Wed, 24 Feb 2016 09:01:45 +0900
[Reading data from pkg(8) ... - 226 packages found - done]
"/usr/ports/Mk/bsd.php.mk", line 342: Malformed conditional (${_USE_PHP_VER${PHP_VER}:Mcurl} != "")
"/usr/ports/Mk/bsd.php.mk", line 342: Malformed conditional (${_USE_PHP_VER${PHP_VER}:Mgd} != "")
"/usr/ports/Mk/bsd.php.mk", line 342: Malformed conditional (${_USE_PHP_VER${PHP_VER}:Mmysqli} != "")

	・・・

"/usr/ports/Mk/bsd.port.mk", line 1885: if-less endif
"/usr/ports/Mk/bsd.port.mk", line 5815: if-less endif
"/usr/ports/Mk/bsd.port.mk", line 5818: if-less endif
make: fatal errors encountered -- cannot continue
** Makefile possibly broken: japanese/wordpress:
** Please report this to the maintainer for japanese/wordpress
--->  Session ended at: Wed, 24 Feb 2016 09:01:47 +0900 (consumed 00:00:02)
/usr/local/sbin/portupgrade:1575:in `get_pkgname': Makefile broken (MakefileBrokenError)
        from /usr/local/sbin/portupgrade:637:in `block (4 levels) in main'
        from /usr/local/sbin/portupgrade:621:in `each'
        from /usr/local/sbin/portupgrade:621:in `block (3 levels) in main'

		・・・

        from /usr/local/sbin/portupgrade:571:in `block in main'
        from /usr/local/lib/ruby/2.1/optparse.rb:880:in `initialize'
        from /usr/local/sbin/portupgrade:238:in `new'
        from /usr/local/sbin/portupgrade:238:in `main'
        from /usr/local/sbin/portupgrade:2380:in `<main>'
 あわわ、なんてこった。

2. package でアップデート

 少しく考えましたが、package でアップデートできればお手軽だし、できそうな気がしましたので・・・。

> pkg upgrade ja-wordpress
Updating FreeBSD repository catalogue...
FreeBSD repository is up-to-date.
All repositories are up-to-date.
The following 14 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
        php56-curl: 5.6.18
        jpeg-turbo: 1.4.2

		・・・

        php56-ftp: 5.6.18
        php56-zlib: 5.6.18

Installed packages to be REINSTALLED:
        ja-wordpress-4.4.1_1 (direct dependency changed: php56-curl)
        libevent2-2.0.22_1 (ABI changed: 'freebsd:8:x86:32' -> 'freebsd:9:x86:32')

The process will require 25 MiB more space.
10 MiB to be downloaded.

Proceed with this action? [y/N]: y
Fetching ja-wordpress-4.4.1_1.txz: 100%    5 MiB   1.2MB/s    00:05
Fetching php56-curl-5.6.18.txz: 100%   26 KiB  27.3kB/s    00:01
Fetching jpeg-turbo-1.4.2.txz: 100%  324 KiB 332.2kB/s    00:01

		・・・

Fetching php56-ftp-5.6.18.txz: 100%   18 KiB  19.3kB/s    00:01
Fetching php56-zlib-5.6.18.txz: 100%   13 KiB  13.7kB/s    00:01
Checking integrity... done (10 conflicting)
Checking integrity... done (0 conflicting)
Conflicts with the existing packages have been found.
One more solver iteration is needed to resolve them.
The following 60 package(s) will be affected (of 0 checked):

Installed packages to be REMOVED:
        php5-extensions-1.7
        php5-xsl-5.4.45

		・・・

        php5-ftp-5.4.45
        php5-curl-5.4.45

New packages to be INSTALLED:
        jpeg-turbo: 1.4.2

		・・・

        php56-zlib: 5.6.18
        compat6x-i386: 6.4.604000.200810_3

Installed packages to be REINSTALLED:
        tiff-4.0.6_1 (options changed)
        libgd-2.1.0_7,1
        ja-wordpress-4.4.1_1 (direct dependency changed: php56-curl)
        analog-6.0_10,1 (options changed)
        smarty-2.6.28 (ABI changed: 'freebsd:8:x86:32' -> 'freebsd:9:x86:32')
        phpmailer-5.2.14 (direct dependency changed: php56)
        libevent2-2.0.22_1 (ABI changed: 'freebsd:8:x86:32' -> 'freebsd:9:x86:32')

The operation will free 922 KiB.
2 MiB to be downloaded.

Proceed with this action? [y/N]: y
Fetching tiff-4.0.6_1.txz: 100%  819 KiB 839.5kB/s    00:01

		・・・

Fetching smarty-2.6.28.txz: 100%  176 KiB 180.3kB/s    00:01
Fetching phpmailer-5.2.6.6.txz: 100%  143 KiB 146.6kB/s    00:01
[1/60] Deinstalling php5-extensions-1.7...
[2/60] Deinstalling jpeg-8_6...

		・・・

[43/60] Installing fontconfig-2.11.1_1,1...
[43/60] Extracting fontconfig-2.11.1_1,1: 100%
Running fc-cache to build fontconfig cache...
/usr/local/share/fonts: skipping, no such directory
/usr/local/lib/X11/fonts: caching, new cache contents: 0 fonts, 1 dirs
/usr/local/lib/X11/fonts/local: caching, new cache contents: 0 fonts, 0 dirs
/root/.local/share/fonts: skipping, no such directory
/root/.fonts: skipping, no such directory
Re-scanning /usr/local/lib/X11/fonts: caching, new cache contents: 0 fonts, 1 dirs
/var/db/fontconfig: cleaning cache directory
/root/.cache/fontconfig: not cleaning non-existent cache directory
/root/.fontconfig: not cleaning non-existent cache directory
fc-cache: succeeded
[44/60] Installing php56-5.6.18...
[44/60] Extracting php56-5.6.18: 100%

		・・・

[59/60] Extracting phpmailer-5.2.14: 100%
[60/60] Reinstalling libevent2-2.0.22_1...
[60/60] Extracting libevent2-2.0.22_1: 100%
Message from ja-wordpress-4.4.1_1:
**** NOTE ****
Before the first use of WordPress, copy wp-config-sample.php to wp-config.php
in /usr/local/www/wordpress and modify it to fit your MySQL.

		・・・

configuration. Both files are extensively commented with instructions
for customization.
Message from compat6x-i386-6.4.604000.200810_3:
*******************************************************************************
*                                                                             *
* Do not forget to add COMPAT_FREEBSD6 into                                   *
* your kernel configuration (enabled by default).                             *
*                                                                             *
* To configure and recompile your kernel see:                                 *
* http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig.html *
*                                                                             *
*******************************************************************************
Message from smarty-2.6.28:
You need to adjust php's include_path to contain `/usr/local/share/smarty'!
For example, insert
        include_path = ".:/usr/local/share/smarty"
into `/usr/local/etc/php.ini'.
Message from phpmailer-5.2.14:
You need to adjust php's include_path to contain `/usr/local/share/phpmailer'!
For example, insert
        include_path = ".:/usr/local/share/phpmailer"
into `/usr/local/etc/php.ini'.
 長いこと PHP 5.4 を使っていたんですな。この機会に 5.6 に上がったようです。  うまくいきそうだったんですが、最後の最後にけつまづいちゃいました。

3. 再度 portupgrade

 周囲はバージョンアップできたようなので再度

> portupgrade -vRr ja-wordpress
--->  Session started at: Wed, 24 Feb 2016 09:14:09 +0900
[Reading data from pkg(8) ... - 199 packages found - done]
[Gathering depends for japanese/wordpress .........(lang/php56)...(devel/autoconf)......(devel/m4).(print/indexinfo)(misc/help2man)......(devel/p5-Locale-gettext)...(devel/gettext-tools)..(devel/gettext-runtime)..(converters/libiconv)(lang/perl5.20)(devel/gmake-lite)(devel/gmake)....(devel/autoconf-wrapper)(devel/pcre)(textproc/libxml2)...(devel/pkgconf)(ftp/php56-curl)...(ftp/curl)....(security/openssl).(security/ca_root_nss).(graphics/php56-gd)......(print/freetype2).(graphics/png)(graphics/jpeg-turbo).(devel/nasm).(devel/t1lib).(databases/php56-mysqli)..(devel/php56-tokenizer)..(textproc/php56-xml)...(archivers/php56-zip)...(archivers/libzip).(archivers/php56-zlib)..(ftp/php56-ftp)... done]
[Exclude up-to-date packages ................................ done]
--->  Upgrade of japanese/wordpress started at: Wed, 24 Feb 2016 09:14:23 +0900
--->  Upgrading 'ja-wordpress-4.4.1_1' to 'ja-wordpress-4.4.2_1' (japanese/wordpress)
--->  Build of japanese/wordpress started at: Wed, 24 Feb 2016 09:14:23 +0900
--->  Building '/usr/ports/japanese/wordpress'
===>  Cleaning for ja-wordpress-4.4.2_1
If you want to upgrade, you must read upgrade document.

===>  License GPLv2 GPLv3 accepted by the user
===>  Found saved configuration for ja-wordpress-3.9.1

		・・・

/bin/mkdir -p /usr/ports/japanese/wordpress/work/stage/usr/local/share/doc/wordpress/
cd /usr/ports/japanese/wordpress/work/wordpress/ && install  -m 0644 license.txt readme.html /usr/ports/japanese/wordpress/work/stage/usr/local/share/doc/wordpress/
====> Compressing man pages (compress-man)
--->  Build of japanese/wordpress ended at: Wed, 24 Feb 2016 09:14:48 +0900 (consumed 00:00:25)

		・・・

[Reading data from pkg(8) ... - 199 packages found - done]
--->  Deinstalling 'ja-wordpress-4.4.1_1'
Checking integrity... done (0 conflicting)
Deinstallation has been requested for the following 1 packages (of 0 packages in the universe):

Installed packages to be REMOVED:
        ja-wordpress-4.4.1_1

The operation will free 21 MiB.
[1/1] Deinstalling ja-wordpress-4.4.1_1...
[1/1] Deleting files for ja-wordpress-4.4.1_1: 100%
[Reading data from pkg(8) ... - 198 packages found - done]
--->  Uninstallation of ja-wordpress-4.4.1_1 ended at: Wed, 24 Feb 2016 09:15:37 +0900 (consumed 00:00:49)
--->  Installation of japanese/wordpress started at: Wed, 24 Feb 2016 09:15:37 +0900
--->  Installing the new version via the port
===>  Installing for ja-wordpress-4.4.2_1
===>   ja-wordpress-4.4.2_1 depends on file: /usr/local/include/php/main/php.h - found

		・・・

===>   ja-wordpress-4.4.2_1 depends on file: /usr/local/lib/php/20131226/ftp.so - found
===>   Registering installation for ja-wordpress-4.4.2_1
Installing ja-wordpress-4.4.2_1...
**** NOTE ****
Before the first use of WordPress, copy wp-config-sample.php to wp-config.php
in /usr/local/www/wordpress and modify it to fit your MySQL.
Maybe you need 'mysqladmin create wordpress' first.
If you are upgrading from 1.x or 2.x to 3.x, please run
http://your.site/wordpress/wp-admin/upgrade.php to upgrade to WordPress 3.x

===>  Cleaning for ja-wordpress-4.4.2_1
--->  Removing temporary files and directories
--->  Removing old package'
--->  Installation of japanese/wordpress ended at: Wed, 24 Feb 2016 09:15:54 +0900 (consumed 00:00:16)
--->  Cleaning out obsolete shared libraries
--->  Upgrade of japanese/wordpress ended at: Wed, 24 Feb 2016 09:16:01 +0900 (consumed 00:01:37)
--->  ** Upgrade tasks 1: 1 done, 0 ignored, 0 skipped and 0 failed
--->  Listing the results (+:done / -:ignored / *:skipped / !:failed)
        + japanese/wordpress (ja-wordpress-4.4.1_1 -> ja-wordpress-4.4.2_1)
--->  Packages processed: 1 done, 0 ignored, 0 skipped and 0 failed
--->  Session ended at: Wed, 24 Feb 2016 09:16:02 +0900 (consumed 00:01:53)
 今度はうまくいきました。と、思っていたら・・・次項!

4. 後日談(重要!!!)

 前項までで、無事 WordPress をアップデートすることができ、WEB の動作も支障がなかったのですが、後日、大変なことになってしまいました。  毎月 Apache のログをローテーションさせているのですが、そのときに Apache を restart させることになります。  前項で php が 5.4 から 5.6 に上がった際に Apache 用のモジュールが消えちゃってたんですな。  そのときは、Apache が実行中だったため、php がキャッシュされており、支障なく動作していたのですが、restart 時に php のモジュールがないもんだから、php ソースがらみの処理がこけちゃってまともに動いてくれない。  2016年3月1日の朝のことです。  気づいたのが 9:00 すぎてたのであわくって復旧しようとしましたが、あれこれやっているうちに 2時間くらいかかっちゃいました。  結局、以下のモジュールを ports で make して reinstall することでなんとか復旧できました。
/usr/ports/lang/php56/
/usr/ports/lang/php56-extensions/
/usr/ports/www/mod_php56/