Home  >  Article  >  Backend Development  >  What to do if php execution time times out

What to do if php execution time times out

王林
王林forward
2021-05-05 18:57:525882browse

What to do if php execution time times out

If we encounter PHP execution timeout in actual work, how should we solve it?

There are three solutions:

1. Modify the php configuration file and find the php.ini file. It should generally be placed in your C:\WINDOWS directory, and then find max_execution_time= 30 ;//Set to the value you want, the unit is seconds

This line means that the maximum execution time is set to 30 seconds. You can modify this value and change it to your expected value. (It can also be set directly to: max_execution_time= 0)

2. Use the ini_set() function. Not everyone can modify the php.ini file, so you can use this function to change your maximum execution time. Limit value, such as:

ini_set('max_execution_time','100');

is set to 100 seconds, you can also set it to 0, then the execution time is not limited.

3. Use the set_time_limit() function. set_time_limit(20) means the maximum execution time plus 20 seconds. However, if you execute safe mode in PHP, set_time_limit() will have no results unless you use the first method.

Free learning video sharing: php tutorial

The above is the detailed content of What to do if php execution time times out. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete