When PHP is running, the following error occurs: Fatal error: Maximum execution time of 30 seconds exceeded in: executionexceeded

Source: Internet
Author: User

When PHP is running, the following error occurs: Fatal error: Maximum execution time of 30 seconds exceeded in: executionexceeded

Solution Analysis:

This error indicates that your php Execution time has exceeded the maximum execution time set in the configuration file for 30 seconds. This is not a problem in your program, but a problem in the system configuration file, if your network speed is fast, this error may not occur if you execute it again. However, you can make some modifications to this problem.

There are three methods:

1. Modify the php configuration file and find the php. ini file. It should generally be placed in your C: \ WINDOWS directory, and then findmax_execution_time = 30 ;//Set it to the value you want, in seconds. This line sets the maximum execution time to 30 seconds. You can modify the value to your expected value. (You can also set it:max_execution_time = 0)

2. Useini_set()Not everyone can modify the php. ini file, so you can use this function to change the maximum execution time limit value, such:ini_set('max_execution_time', '100'); The value is set to 100 seconds. You can also set the value to 0, which means that the execution time is not limited.

3. Useset_time_limit()Function, set_time_limit(20)The maximum execution time is 20 seconds,set_time_limit()There will be no results unless you use the first method.

The following are some explanations:

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

Set_time_limit --- limit the maximum execution time


 void set_time_limit (int seconds)

Note: set the number of seconds that a program can run. If the time limit is reached, the program will return an error.

The default limit time is 30 seconds. The value of max_execution_time is defined in the structure file (php3.ini in PHP3 and php in PHP4. ini). If the number of seconds is set to 0, there is no time limit.

When you call this function,set_time_limit( )The maximum execution time is calculated from scratch. That is to say, if the maximum execution time is 30 secondsset_time_limit(20)It took 25 seconds to run the program, and the maximum length of the program will be 45 seconds.

Note:When PHP is executed in safe mode,set_time_limit( )There will be no results, unless you disable the security mode or modify the time limit in the structure file (php3.ini in PHP3, php. ini in PHP4.


The above is all the content of this article. I hope this article can solve this problem and help you. If you have any questions, you can leave a message, thank you for your support.

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.