I am trying to set the PDO::ATTR_TIMEOUT to 10 seconds, but the change is not persisting. The timeout is stuck at 2 seconds no matter what I try.
config/database.php:
'mysql' => [
// ...
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::ATTR_TIMEOUT => 10,
]) : [],
],
Even after running this command to clear the config cache, it's not taking.
php artisan optimize:clear
Also tried setting it in the contoller:
PDO::setAttribute(PDO::ATTR_TIMEOUT, 10);
But Laravel throws an Error:
Non-static method PDO::setAttribute() cannot be called statically
Even though setAttribute is a static method in the PHP docs. Shouldn't have to set it this way anyway, but just the configuration setting is not persisting.