Get the App
SLTechnology News&Howtos  ›  Development  › 

How to set the php script not to time out

Shulou Source: shulou.com Published: 2022-06-03 10:05:22 09月22日 Update

This article is about how php scripts are set not to time out. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Php script settings do not time out methods: 1, in php.ini set "max_execution_time = 120;"; 2, through the PHP ini_set function to set "ini_set" ("max_execution_time", "120"); "and so on.

This article operating environment: windows7 system, PHP7.1 version, DELL G3 computer

How to set the php script not to time out?

The solution of PHP script execution timeout

Three methods of setting the maximum execution time of script by PHP

1. Set it in php.ini

Max_execution_time = 120

2. Set it through the ini_set function of PHP

Ini_set ("max_execution_time", "120")

3. Set through the set_time_limit function

Set_time_limit (120)

If the above numbers are set to 0, there is no limit, and the script will be executed until the end of execution.

Therefore, for scripts that need to be executed for a long time, you can usually add the following code at the beginning of the php code

Set_time_limit (0)

Thank you for reading! This is the end of the article on "how to set the php script not to time out". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

Tags: Script function code content method more article good practical maximum method beginning number article unlimited time environment computer look knowledge Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux Xiaomi OPPO Reno MySQL macOS