MySQL-How to end the execution of a script before the PHP script times out

Source: Internet
Author: User

There are a lot of functions in my PHP script that call someone else's interface, but these interfaces are sometimes very slow, which will cause my script to time out and report "504 Gateway Time-out" on the page!

I want to abort the function that called the interface before the PHP script times out and return to the page with a hint, but I don't know how to know in advance that the script is about to expire.

Special Note: A function such as set time limit () is not used in my script.

Reply content:

There are a lot of functions in my PHP script that call someone else's interface, but these interfaces are sometimes very slow, which will cause my script to time out and report "504 Gateway Time-out" on the page!

I want to abort the function that called the interface before the PHP script times out and return to the page with a hint, but I don't know how to know in advance that the script is about to expire.

Special Note: A function such as set time limit () is not used in my script.

Using Gearman

Based on the description of the problem, guessing uses the Fsockopen function. If you are using the Fsockopen function, you can see the following connection http://us1.php.net/manual/en/function.stream-set-timeout.php

  • 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.