Have you tried increasing table_definition_cache as per this stack overfow?
Run this in mysql command line tool
SET GLOBAL table_definition_cache = 1024
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello, I have a query that on my live server (but not on the test server - yeah that's confusing) throws a "General error: 1615 Prepared statement needs to be re-prepared" after some Googling people seem to get around this by adding this to config/database.php
'options' => [
\PDO::ATTR_EMULATE_PREPARES => true
]
This however brings some some [url=https://michaelseiler.net/2016/07/04/dont-emulate-prepared-statements-pdo-mysql/]security concerns[/url] with it. So instead what I did was put this around my query (that I know to be safe as it only uses values already validated and in the database.
$pdo = \DB::connection()->getPdo();
$pdo->setAttribute(\PDO::ATTR_EMULATE_PREPARES, true);
//Query :)
$pdo->setAttribute(\PDO::ATTR_EMULATE_PREPARES, false);
I'm just kinda wondering why no one else seems to have done this, wouldn't this be the smarter/saver way to do it?
Please or to participate in this conversation.