There is a system written in laravel5.2 running on a server with ubuntu (16.04 64bit) and lamp (php7, mysql5.7, apache2).
The system has a task that runs on a schedule and runs for about half an hour, the problem is that the task is not completed until the end, and it writes an exception to the log:
PDOException: SQLSTATE[HY000] [2002] Connection refused in /vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:55 That is, the connection with the database initially works, then after about 12 minutes, with the next request, laravel tries to update the connection, and then drops with this exception.
Googling problems gave advice to change the host in .env from localhost to 127.0.0.1, this did not help.
At the same time, this problem is not observed on the local machine on mamp and the task is fully executed.
What could be the problem?