I keep getting this error incessantly. How do I avoid it with Yii? I saw some questions about Yii 1 but they use options that aren't in the documentation: http://www.yiiframework.com/doc-2.0/yii-db-connection.html, http://php.net/manual/en/pdo.setattribute.php
Error: PDOStatement::execute(): MySQL server has gone away
The query is normally very simple.
The SQL being executed was: SHOW FULL COLUMNS FROM
ad_group_keyword
I'm using MySQL (from ClearDB) and I don't have access to the server configurations.
I added these attributes to the db
but they did not help.
'attributes' => [
PDO::ATTR_PERSISTENT => false, // ClearDB connection limit is 90s
PDO::ATTR_TIMEOUT => 90,
PDO::MYSQL_ATTR_INIT_COMMAND => 'select 1',
]
Ok I solved this by migrating away from MySQL on ClearDB. I wasn't the only person with this problem. https://www.designedbyaturtle.co.uk/2015/dedicated-vs-shared-databases-a-mysql-has-gone-way-fix/
I migrated from MySQL to Heroku Postgres. https://stackoverflow.com/a/16732524/148844