Home >Backend Development >PHP Tutorial >How to set timeout limit for php page function, php page function timeout_PHP tutorial
The example in this article describes how to set timeout limits for PHP page functions. Share it with everyone for your reference. The specific method is as follows:
When encountering a page program execution timeout, Fatal error: Maximum execution time of 300 seconds exceeded will be prompted because the program execution time exceeds the maximum allowed execution time. We have summarized several solutions for everyone to choose from.
For functions, we can use the following method to directly set the timeout period for the function. The code is as follows:
1. Modify the php.ini file, the code is as follows:
Remember to restart php after making the change. This method will take effect on all programs after the change.
2. Modify your program and add code to the script that takes longer than the default value (30 seconds):
Set to 0 to indicate no time limit.
I hope this article will be helpful to everyone’s PHP programming design.