You can use something like this
DB::statement("SET SESSION time_zone = 'xxxx'");
You might even do this statement in your AppServiceProvider ;)
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi, I need to set wait_timeout session variable for the database connection. BUt:
It has to be done inside my application because the hosting team refuses to change this option "for all of the users". They say I can do it easily by issuing the following query:
SET SESSION wait_timeout = XXXXXX.
I need to find a proper place in which to issue this query. As I understand, it should be issued somewhere near connection establishing, is it right? There is no such option in config/database.php and I shouldn't touch files inside vendor/, off cause. Besides, this adjustment should be indexed by git.
So, could you advise a proper way to inject this?
You can use something like this
DB::statement("SET SESSION time_zone = 'xxxx'");
You might even do this statement in your AppServiceProvider ;)
Please or to participate in this conversation.