MySQL server has gone away when downloading

I am trying to download ~100 files from my hosted nextcloud server. Nexcloud generates a zip file of ~350 MB. The download of that file always stalls after ~10 MB.

In the log file I found:

Error	PHP	Uncaught Error: Access to undeclared static property: OC\Files\Filesystem::$normalizedPathCache in /home/clients/77b4be0c67b1b0092230ddb1aab5268c/web/nextcloud/lib/private/Files/Filesystem.php:806 Stack trace: #0 /home/clients/77b4be0c67b1b0092230ddb1aab5268c/web/nextcloud/lib/private/Files/View.php(2018): OC\Files\Filesystem::normalizePath('/jeancf/files/I...') #1 /home/clients/77b4be0c67b1b0092230ddb1aab5268c/web/nextcloud/lib/private/Files/View.php(1156): OC\Files\View->unlockFile('/InstanUpload/2...', 1) #2 [internal function]: OC\Files\View->OC\Files\{closure}() #3 /home/clients/77b4be0c67b1b0092230ddb1aab5268c/web/nextcloud/apps/files_external/3rdparty/icewind/streams/src/CallbackWrapper.php(109): call_user_func(Object(Closure)) #4 [internal function]: Icewind\Streams\CallbackWrapper->stream_close() #5 {main} thrown at /home/clients/77b4be0c67b1b0092230ddb1aab5268c/web/nextcloud/lib/private/Files/Filesystem.php#806	2016-12-27T13:31:54+0100
Error	PHP	PDOStatement::execute(): Error reading result set's header at /home/clients/77b4be0c67b1b0092230ddb1aab5268c/web/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php#91	2016-12-27T13:31:15+0100
Error	PHP	PDOStatement::execute(): MySQL server has gone away at /home/clients/77b4be0c67b1b0092230ddb1aab5268c/web/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php#91	2016-12-27T13:31:15+0100

There are many instances of MySQL server has gone away in the log file recently. I can provide the full log file if required (I tried to download it from the web interface but it stalled as well. I had to FTP it).

Server configuration: PHP 7.0.7, MySQL 5.6 and Apache 2.2.

Check your timeout settings for mysql (there is also a timeout setting in php.ini regarding mysql connections). Also verify that your system does not run out of memory and starts to kill processes.

Thanks. A download size limit was configured by default on the server. Increasing it resolved the issue.