動かざることバグの如し

近づきたいよ 君の理想に

Ubuntu 16.04ではPHP5.6をインストールすることは出来ない

発端

さぁ心機一転、Ubuntu16.04でPHPインストールしようとした。まぁ7.xも悪くないけど今回は安定志向ということでPHP5.6をインストールすることに

sudo apt show php

結果

user@ubuntu:~$ sudo apt show php
Package: php
Version: 1:7.0+42+deb.sury.org~xenial+1
Priority: optional
Section: php
Source: php-defaults (42+deb.sury.org~xenial+1)
Maintainer: Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>
Installed-Size: 11.3 kB
Depends: php7.0
Download-Size: 4,588 B
APT-Sources: http://ppa.launchpad.net/ondrej/php/ubuntu xenial/main amd64 Packages
Description: server-side, HTML-embedded scripting language (default)
 PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used
 open source general-purpose scripting language that is especially suited
 for web development and can be embedded into HTML.
 .
 This package is a dependency package, which depends on Debian's default
 PHP version (currently 7.0).

N: There is 1 additional record. Please use the '-a' switch to see it

ん??????????????????デフォルトで7だと?

16.04のデフォルトはPHP 7

なんかそうっぽい まだ安定版じゃないって開発者自身が言ってたくせに何やってるんだ感

5.6をインストール

いつものPPA追加するしかない

sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install php5.6
user@ubuntu:~$ sudo apt show php5.6
Package: php5.6
Version: 5.6.22-4+deb.sury.org~xenial+1
Priority: optional
Section: php
Maintainer: Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>
Installed-Size: 278 kB
Provides: php
Depends: libapache2-mod-php5.6 | php5.6-fpm | php5.6-cgi, php5.6-common
Download-Size: 253 kB
APT-Manual-Installed: yes
APT-Sources: http://ppa.launchpad.net/ondrej/php/ubuntu xenial/main amd64 Packages
Description: server-side, HTML-embedded scripting language (metapackage)
 This package is a metapackage that, when installed, guarantees that you
 have at least one of the four server-side versions of the PHP interpreter
 installed. Removing this package won't remove PHP from your system, however
 it may remove other packages that depend on this one.
 .
 PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used
 open source general-purpose scripting language that is especially suited
 for web development and can be embedded into HTML.

やっためう!

これだけでは終わらないPHP5.6の罠

Apache2で使うときは

sudo apt install libapache2-mod-php5.6 libapache2-mpm-itk

した後に sudo a2enmod php5.6 が必要

【MySQL】Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENTと出る

MySQLアップデートするとOwncloudが動かない。

おかしいと思って見ると以下の様なエラーが出てた。

An exception occurred while executing 'INSERT INTO `oc_users` ( `uid`, `password` ) VALUES( ?, ? )' with params ["user", "*************************"]: SQLSTATE[HY000]: General error: 1665 Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-based logging. InnoDB is limited to row-logging when transaction isolation level is READ COMMITTED or READ UNCOMMITTED.

General error: 1665

原因はわからないけど、/etc/mysql/my.cnfmysqld欄に以下を追記

binlog-format = MIXED

で再起動したら直った

【Raspi】Cronが実行されない場合の対処法

環境

  • Raspberry Pi 2
  • RASPBIAN JESSIE LITE Release date:2016-05-10

cron書いても実行されない

書式間違ってるのと思って何度も確認したけど改善しなかった

原因

ふと/var/log/syslogを見てみると大量の失敗ログがあるではないか!

May 29 22:49:01 raspberrypi CRON[22648]: (pi) CMD (/bin/bash -lc 'cd /home/pi/hoge && bundle exec ruby save.rb')
May 29 22:49:01 raspberrypi CRON[22644]: (CRON) info (No MTA installed, discarding output)

No MTA installed, discarding output

どうもデフォルトでMTAがインストールされていないらしく、postfixをインストールする必要がある

sudo apt-get install postfix

最初っからいれとけよこんなもん>Raspi