How to set page running time in php

王林
Release: 2023-03-12 09:34:02
Original
2403 people have browsed it

How to set the page running time in php: 1. Open the php.ini configuration file; 2. Find the max_execution_time variable; 3. Modify the page running time.

How to set page running time in php

The operating environment of this article: windows10 system, php 7.1, thinkpad t480 computer.

We all know that by default, the maximum execution time configured in php.ini is 30 seconds, which is specified by the max_execution_time variable in php.ini. So if we have a job that takes a lot of time, such as sending a large number of emails, or performing a huge statistical analysis of data, the server will forcibly terminate the executing program after 30 seconds even if the task is not completed. . It is conceivable that we are very unwilling to see this situation, so can we set the page execution time? The answer is yes.

Let’s take a look at the specific methods.

1, two methods to modify the maximum execution time

(1) Directly modify the value of max_execution_time in php.ini.

How to set page running time in php

(2) If you do not have permission to modify the php.ini file, or we want to set up individual pages for some pages. Then you can also set it in the PHP program page, the code is as follows (a value of 0 means there is no execution time limit).

ini_set('max_execution_time', '0')
Copy after login

Recommended learning:php training

The above is the detailed content of How to set page running time in php. 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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!