What is the difference between :
mysql.connect_timeout
that we can find in php.ini
and
connect_timeout
that belongs to MySQL configuration (show variables
).
Knowing that Apache server and MySQL server are two distant VPS with a VIP between them, what is the value considered by the whole environment (Varnish + Apache + MySQL)?
mysql.connect_timeout
tells PHP how long it should wait for a response from the MySQL server when it tries to connect.
connect_timeout
in MySQL configuration tells the MySQL server how long to wait for a connect packet from the client before responding with a Bad handshake
error.
Apache is not involved in either of these timeouts, they're just between PHP and MySQL. First PHP connects to MySQL; if it doesn't get a response before mysql.connect_timeout
, it will report an error. Once that succeeds, PHP sends a connect
packet to MySQL; if it doesn't do that within connect_timeout
, MySQL will report an error and close the connection.