Home > Database > Mysql Tutorial > Why are `ini_set(\'max_execution_time\')` and `set_time_limit()` ineffective on a server but work on localhost?

Why are `ini_set(\'max_execution_time\')` and `set_time_limit()` ineffective on a server but work on localhost?

Patricia Arquette
Release: 2024-11-01 05:06:27
Original
422 people have browsed it

Why are `ini_set('max_execution_time')` and `set_time_limit()` ineffective on a server but work on localhost?

ini_set, set_time_limit, and (max_execution_time) Not Functioning

Question:

Why do set_time_limit() and ini_set('max_execution_time') function correctly on a localhost but fail on another server?

Answer:

The inability to adjust execution time using these functions stems from the PHP runtime configuration setting, max_execution_time, being prohibited from modification via ini_set() when safe mode is enabled.

Explanation:

Many web hosts employ safe mode, a security measure that restricts certain PHP functions. When running in safe mode, attempts to alter max_execution_time using ini_set() are ignored.

The solution to this issue is either to disable safe mode or change the time limit in the php.ini configuration file. Additionally, set_time_limit() is also affected by this restriction in safe mode, with no workaround available.

The above is the detailed content of Why are `ini_set(\'max_execution_time\')` and `set_time_limit()` ineffective on a server but work on localhost?. For more information, please follow other related articles on the PHP Chinese website!

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 Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template