PHP Fatal error: PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away
PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away
This is a common error happens if the PHP script taking too long to execute or response is very large.
We can resolve this by modifying the database parameters.
Step1: Login to the database server via SSH as root.
Step2: Open the MySQL configuration file.
#vi /etc/my.cnf
Step3: Update the following parameters and save.
max_allowed_packet = 256M
wait_timeout = 1800
connect_timeout = 120
interactive_timeout=300
Step4: Restart MySQL service.
#systemctl restart mysqld
That's all…