PHP MySQLi timeout on locked tables?
        Posted  
        
            by Marcin
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Marcin
        
        
        
        Published on 2010-03-23T11:54:44Z
        Indexed on 
            2010/03/23
            12:43 UTC
        
        
        Read the original article
        Hit count: 450
        
Hi guys
I have a weird problem with mysqli timeout options, here you go:
I am using mysqli_init() and real_connect() in order to set MYSQLI_OPT_CONNECT_TIMEOUT
$this->__mysqli = mysqli_init();
if(!$this->__mysqli->options(MYSQLI_OPT_CONNECT_TIMEOUT,1))
    throw new Exception('Timeout settings failed')
$this->__mysqli->real_connect(host,user,pass,db);
....
Then I am initiating query on locked table (LOCKE TABLE users WRITE) and its just hanging, ignoring all my settings even:
set_time_limit(1);
ini_set('max_execution_time',1);
ini_set('default_socket_timeout',1);
ini_set('mysql.connect_timeout',1);
I understand why set_time_limit(1) and max_execution_time is ignored but why other timeouts and especially MYSQLI_OPT_CONNECT_TIMEOUT are ignored and how to solve it.
I am using PHP 5.3.1 on Windows and Linux boxes, please help.
© Stack Overflow or respective owner