Laravel 4.2 : MYSQL Timeout. Where to change the time gloabally

2.7k views Asked by At

ErrorException: PDO::commit(): MySQL server has gone away

This is a message i am getting. If i set all the variables in xampp (my.ini) it doesn´t change anything. Example :

`innodb_lock_wait_timeout = 1
net_read_timeout = 1
net_write_timeout = 1
interactive_timeout = 1
wait_timeout = 1
delayed_insert_timeout = 1
slave_net_timeout = 1
lock_wait_timeout = 1
connect_timeout = 1`

Also if i change them in the database.php of Laravel Configuration it doesn´t help at all

Example :

'connections' => array(

        'mysql' => array(
            'driver'    => 'mysql',
            'host'      => 'localhost',
            'database'  => 'xy',
            'username'  => 'root',
            'password'  => 'root',
            'charset'   => 'utf8',
            'collation' => 'utf8_unicode_ci',
            'prefix'    => 'xy_',
            'wait_timeout'  =>  '1',
            'interactive_timeout'   => '1',
            'net_read_timeout'  => '1',
        ),

Anyone got an idea where to change it?

1

There are 1 answers

1
Dan H On

Timeouts are in seconds. The timeouts you have in your configuration file are all set to 1, meaning the connection will be terminated in 1 second.

Please refer to the official MySQL documentation regarding server variables.