Home  >  Article  >  Backend Development  >  How to solve php mysql settings timeout problem

How to solve php mysql settings timeout problem

藏色散人
藏色散人Original
2020-07-24 10:19:112567browse

php Mysql setting timeout solution: first find and open the configuration file "php.ini"; then find the "mysql.connect_timeout" item in the file; finally modify the value to 2 or 3.

How to solve php mysql settings timeout problem

Recommended: "PHP Tutorial"

php connection mysql timeout problem

Phenomena:

When php establishes a connection with mysql, it waits for a long time, and finally reports that the script execution time exceeds the maximum value.

Source of the problem:

When PHP needs to connect to mysql, generally there will be no misconfiguration. If the machine where mysql is located is turned off, or there is a network problem, or the configuration is wrong, then you need to It will take a long time to know the result of the connection. The waiting time is determined by mysql.connect_timeout in php.ini (unit: seconds). It is recommended to set it to 2 or 3

The above is the detailed content of How to solve php mysql settings timeout problem. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn