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:
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!