Blank page after server restart // PHP fatal error


i reinstalled the whole system today. The nextcloud install was also done correctly … i could log in and use nextcloud without issues after the install. But after a restart from ubuntu (the server), it was not possible to access nextcloud anymore. I always get a blank/white page after typing in the IP. At the bottom you can see the error log.

I used this tutorial to install it:

Nextcloud version: 12
Operating system and version: 16.04 LTS
Apache version: 2.4.18
PHP version: 7.0.22

Error log apache2:

[Mon Oct 23 15:07:22.998751 2017] [:error] [pid 1344] [client] PHP Fatal error: Uncaught Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occured in driver: SQLSTATE[HY000] [2002] No such file or directory in /var/www/html/nextcloud/lib/private/DB/Connection.php:61\nStack trace:\n#0 /var/www/html/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(429): OC\DB\Connection->connect()\n#1 /var/www/html/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(389): Doctrine\DBAL\Connection->getDatabasePlatformVersion()\n#2 /var/www/html/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(328): Doctrine\DBAL\Connection->detectDatabasePlatform()\n#3 /var/www/html/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(623): Doctrine\DBAL\Connection->getDatabasePlatform()\n#4 /var/www/html/nextcloud/lib/private/DB/Connection.php(148): Doctrine\DBAL\Connection->setTransactionIsolation(2)\n#5 /var/www/html/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php(172): OC\DB\Connection->__construct(Array, Object(Doctrin in /var/www/html/nextcloud/lib/private/DB/Connection.php on line 61

It seems like Nextcloud can’t connect to the database. Is the MySQL-Server running?

Normally the MySQL Server should start by itself after a ubuntu restart or is this wrong?
How can i check if auto-start is enabled and if it is running?

I believe nothing starts automatically unless a script automatically or you manually enable it.
If you use systemd:
systemctl enable mysql

Unfortunately it doesn’t work! :frowning:
Still same error.
… any other suggestions?

If mysql is up correctly (service mysql status), also check if the PHP mysql module is installed and enabled:
apt install php-mysql or apt install php7.0-mysql
and php -m does pdo_mysql show up in the list?

I had the same exact problem and this help me fix it. Mariadb binary logging unable to start mysql

1 Like

Thank you! This worked! :slight_smile: