PHP sets the maximum execution time of code

怪我咯
Release: 2023-03-10 19:00:01
Original
2852 people have browsed it

phpWhen certain operations are completed, it may take a long time to execute. This requires setting its execution time, otherwise the server will stop execution after the execution time times out and the page will be blank. Two solutions are recommended below:

1.php file page settings:

<?php
//修改最大执行时间
<a href="https://www.baidu.com/s?wd=ini_set&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1YdPvnsn10LPHnvnvnYrA7h0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EnHfsnj04njc1" target="_blank" class="baidu-highlight">ini_set</a>(&#39;max_execution_time&#39;, &#39;0&#39;);
//修改此次最大<a href="https://www.baidu.com/s?wd=%E8%BF%90%E8%A1%8C%E5%86%85%E5%AD%98&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1YdPvnsn10LPHnvnvnYrA7h0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EnHfsnj04njc1" target="_blank" class="baidu-highlight">运行内存</a>
<a href="https://www.baidu.com/s?wd=ini_set&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1YdPvnsn10LPHnvnvnYrA7h0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EnHfsnj04njc1" target="_blank" class="baidu-highlight">ini_set</a>(&#39;memory_limit&#39;,&#39;128M&#39;);
 
/***
 * 
 * 代码块省略......
 * 
 * 
 */
 
?>
Copy after login

php.iniConfiguration file settings (specific values, set as needed):

max_execution_time = 60

memory_limit = 128M

PHP sets the maximum execution time of code

PHP sets the maximum execution time of code

##Note: If the execution memory is completely satisfied, then No need to set it up. Specific settings can be set flexibly according to the situation.

The above is the detailed content of PHP sets the maximum execution time of code. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template