使脚本执行无限

2022-01-14 00:00:00 xampp php

我需要在 localhost (xampp) 中运行一个脚本,它将生成 14400 条记录并将它们添加到数据库中,我设置了 max_execution_time = 50000000000,我不知道是否可以通过将其设置为 0 或 -1.但是我之前用这个 max_execution_time 到 50000000000 尝试了这个脚本,但它在某个点停止了,我不知道还有什么可以限制执行时间,我已经运行了很多次,我厌倦了等待和再次失败,什么我应该在再次运行此脚本之前进行更改,这次完成工作吗?

I need to run a script into localhost (xampp) which will generate 14400 records and adds them into database, I have set the max_execution_time = 50000000000, I dont know if I can make it unlimited by setting it to 0 or -1. But I tried this script before with this max_execution_time to 50000000000 and yet it stoped at certain point, I dont know what else could limit the execution time, I have been running this a lot of times and I am tired of waiting and failing again, what should I change before I run this script again and this time to finish the job?

推荐答案

您必须将其设置为零.零意味着脚本可以永远运行.在脚本开头添加以下内容:

You'll have to set it to zero. Zero means the script can run forever. Add the following at the start of your script:

ini_set('max_execution_time', 0);

参考max_execution_time

注意:

set_time_limit(0);

会有同样的效果.

相关文章