Home > Database > Mysql Tutorial > body text

Why do ini_set(\'max_execution_time\') and set_time_limit() fail to change configuration on a remote server?

Mary-Kate Olsen
Release: 2024-10-28 20:30:02
Original
897 people have browsed it

Why do ini_set('max_execution_time') and set_time_limit() fail to change configuration on a remote server?

ini_set() and set_time_limit() Ignore Configuration Changes on Remote Server

When using ini_set('max_execution_time', 50) or set_time_limit(50) locally, the ini_get('max_execution_time') function returns 50 as expected. However, on a different server, it echoes the default 30, disregarding the specified setting.

Reason:

The inability to change the max_execution_time configuration with ini_set() and set_time_limit() stems from the presence of safe mode. Safe mode is a PHP configuration that restricts certain operations, including modifying runtime settings like max_execution_time via ini_set().

Workaround:

To circumvent this issue, you have two options:

  • Disable safe mode in the PHP configuration (not recommended for security reasons).
  • Modify the max_execution_time setting directly in the php.ini configuration file.

Additional Note:

The same restriction applies to the set_time_limit() function, as indicated in the PHP manual:

"This function has no effect when PHP is running in safe mode. There is no workaround other than turning off safe mode or changing the time limit in the php.ini."

The above is the detailed content of Why do ini_set(\'max_execution_time\') and set_time_limit() fail to change configuration on a remote server?. 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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!