Trying to install freepbx 14 on Ubuntu 16.04 with Asterisk 13.16 - SQLSTATE[42000] Syntax error or access violation: 1067 Invalid default value for 'time'

As the title says I’m trying to install freepbx 14.

I have installed all dependencies listed on the article in the wiki of how to install freepbx 13 on ubuntu 14 but instead of php5 I’ve installed php7.0 which should be compatible with freepbx 14.

I get this error message:

[Doctrine\DBAL\Exception\DriverException] An exception ocurred while executing ‘CREATE TABLE freepbx_log (id INT AUTO_INCREMET NOT NULL, time DATETIME DEFAULT ‘0000-00-00 00:00:00’ NOT NULL, section VARCHAR(50) DEFAULT NULL, level VARCHAR(255) DEFAULT ‘error’ NOT NULL, status INT DEFAULT 0 NOT NULL. message LONGTEXT NOT NULL, INDEX time(time,level), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4 COLLATE utf8mb4_uni code_ci ENGINE = InnoDB’: SQLSTATE[42000] Syntax error or access violation: 1067 Invalid default value for ‘time’

Is this a bug or something I can get around?

Nope. It’s not.

This is a mariadb/mysql problem anyway, so that’s neither here nor there.

So the problem is incompatibility of freepbx 14 and Ubuntu 16.04 and something I can’t do anything about?

The problem is that the definition of the ‘time’ field in the mariadb/MySQL installation you are using is invalid.

The time entry ‘0000-00-00 00:00:00’ is what is returned by a datetime field when it’s allowed to be set to NULL, but the field definition says that the field can’t be NULL.

Google for “mysql Invalid default value datetime” for more information.