Troubleshooting PHP Program Runtime: Fatal error:maximum execution time of seconds exceeded in error tips _php tips

Source: Internet
Author: User
Tags ini safe mode time limit

Resolve Analysis:

This error is that your PHP execution time over the configuration file set in the maximum execution time of 30 seconds, this is not the problem of your program itself, but the system's configuration file problem, if your network speed, you may be able to do it again will not be such a mistake, but With this problem, you can make some changes.

There are three kinds of methods:

1. Modify the PHP configuration file, find the php.ini file, it should be placed in your C:\WINDOWS directory, and then find max_execution_time = 30 ;// the set to the value you want, the unit is seconds, this line, this is the setting of the maximum execution time of 30 seconds, you can make a correction to this value, Change to your expectations. (can also be set directly to: max_execution_time = 0 )

2. Using ini_set() functions, not everyone can modify the php.ini file, then you can use this function to change your maximum execution time limit, such as: ini_set('max_execution_time', '100'); set to 100 seconds, you can also set to 0, then do not limit the execution time.

3. Using set_time_limit() functions, set_time_limit(20) It means maximum execution time plus 20 seconds, but if you execute Safe mode in PHP, set_time_limit() there will be no results unless you use the first method.

Here are some of the explanations:

Set_time_limit---Limit the maximum execution timeset_time_limit(PH3 , PHP4)

Set_time_limit---Limit the maximum execution time

Grammar:

void set_time_limit (int seconds)

Note: Set the number of seconds a program allows to execute, and if the time limit is reached, the program will return an error.

Its preset limit time is 30 seconds, the value of max_execution_time is defined in the structure file (called Php3.ini in PHP3, PHP4 is called php.ini), and if the number of seconds is set to 0, there is no time limit.

When this function is called, calculates the longest set_time_limit( ) execution time from zero, that is, if the maximum execution time is a preset 30 seconds, and set_time_limit(20) 25 seconds have been spent executing the program before calling the function, the maximum execution time for the program will be 45 seconds.

Note: when PHP is executed in safe mode, set_time_limit( ) there will be no results unless you turn off Safe mode or modify the time limit in the structure file (called Php3.ini in PHP3, called PHP.ini in PHP4).

Summarize

The above is the entire content of this article, I hope that through the content of this article can solve the problem we have encountered, to everyone can help, if there are questions you can message exchange, thank you for your support cloud habitat community.

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.