In PHP development, I often use timeout processing to timeout. I will talk about several scenarios, it is convenient for users who need to work in PHP development to use timeout handling to timeout. I will talk about several scenarios:
1.
In the PHP development work very much uses in the timeout processing to the timeout situation, I said several scenes:
1. Get data asynchronously if one of the backend data sources is unsuccessful, skip, not affect the entire page presentation
2. To
PHP connects to MySQL mainly by using the libmysqlclient client library provided by Mysql, and also extends the extensions of mysql and mysqli, which is relatively better and more stable than mysql.
Currently, you can set options to operate the
Currently, you can set options to operate the connection timeout of two client extension libraries, such as mysqli:
Copy codeThe Code is as follows: // Create an object
$ Mysqli = mysqli_init ();
// Set the timeout Option
$ Mysqli-> options
Currently two client-side extension Library connection timeouts can be set to operate with options such as mysqli:
Copy Code code as follows:
Creating objects
$mysqli = Mysqli_init ();
Set timeout options
$mysqli->options
Phenomenon: PHP can connect to MySQL through the normal agent. However, after you execute query, you wait and no data returns.As a result, the PHP-FPM process is all blocked at the place where the data is being read. Cannot process other normal
PHP connects to MySQL mainly by using the libmysqlclient client library provided by Mysql, and also extends the extensions of mysql and mysqli, which is relatively better and more stable than mysql.
PHP connects to MySQL mainly by using the
[Switch] PHP: How to Handle timeout when reading the HTTP interface
Address: https://www.jianshu.com/p/446ea7aaea86
Recently, I encountered a slow reading of the HTTP interface (using the PHP server language), so I want to talk about the timeout
Background information:Previously, because the price of AWS EC2 more expensive and rented other foreign small vendors VPS, after using more than 3 years, found that the AWS EC2 Price is much cheaper than the VPS currently in use.The T1.MICRO model
Preface
To understand the connection timeout problem between the browser and Apache, you need to understand the HTTP Keep-alive property first. First, a brief introduction to Keep-alive, you can find more detailed information from the Internet.
Both
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.