PHP Curl Set 1000 milliseconds time-out (intranet request), sometimes there will be a timeout exception, how to solve?

Source: Internet
Author: User
Keywords Php

PHP Curl Set 1000 milliseconds time-out (intranet request), sometimes there will be a timeout exception, how to solve?

Reply content:

PHP Curl Set 1000 milliseconds time-out (intranet request), sometimes there will be a timeout exception, how to solve?

There is no alternative to setting a larger time-out on the PHP side, which is primarily about optimizing the page being visited. Since is the intranet request, the network speed certainly does not need to consider, then why also timeout?
1-The page in question has a performance problem: it is usually caused by data search, try to optimize (such as simple query does not time out, complex query timeout);
2-the page is logically complex and involves a large amount of data: Complete complex logic through cron-job and cache the results, rather than starting processing when the request is received (such as obtaining the last 3-month Sales report in Excel format);
3-The requested resource is too large: for example, the content is large, the transmission cannot be completed within 10 seconds, and the delivery URL is used instead of the content of the resource.
That's all I think about, I hope it works.
If simply because of the network fluctuations can be caused by repeated attempts, such as failure to start again, until the failure of 10 times to write down the log, and then return to the caller error message.

A second timeout? Well, I think the timeout is normal.

Since it is the intranet, the speed will be very fast, it is recommended not to set the time, of course, if you are worried about the process card, you can set the default value on the line

Time-out or error logging analysis causes, specifically addressed

You can do the timeout retry mechanism, timeout the specific code you look at, like 7 and 28

  • Contact Us

    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.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.