PHP script execution timeout solution

Source: Internet
Author: User
: This article mainly introduces the PHP script execution timeout solution. if you are interested in the PHP Tutorial, please refer to it. PHP default script execution timeout is 30 seconds, which is caused by php. if the max_execution_time variable in ini is specified, the server will forcibly stop the program being executed after 30 seconds. to execute a script with a running time greater than 30 seconds, you can solve the problem by using the following methods:
Modify the execution time limit of php. ini scripts
Edit php. ini and modify the max_execution_time value:
Max_execution_time= 500
// You need to reload php. ini and restart the web server to make the modification take effect.

Set the script execution time through the. htaccess file
Php_value max_execution_time 500

Set the maximum execution time in the script
Ini_set ('max _ execution_time ', 500 );

Cancel the script time limit using php functions
Set_time_limit (0 );
Set_time_limit is used to set the script time-out time. this function specifies that the program must end in the specified number of seconds from the time of running the sentence. if the time-out occurs, the program exits with an error.
Usage: set_time_limit (seconds );
// When the number of seconds is 0, it indicates that the script has no time limit.

The above describes the PHP script execution timeout solution, including the content, hope to be helpful to friends who are interested in the PHP Tutorial.

Related Article

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.