8

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)?

2 Answers 2

12

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.

Sign up to request clarification or add additional context in comments.

Comments

0

The shortest timeout within the stack would be essentially act as your timeout. If you hit a timeout, the longer timeout will never get hit, so it won't matter.

1 Comment

Paul is this really true given that mysql.connect_timeout handles PHP to MySQL and connect_timeout handles MySQL to PHP?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.