ini_set, set_time_limit, (max_execution_time) - not working
Solution 1
You can not change this setting with ini_set() when running in safe mode. The only workaround is to turn off safe mode or by changing the time limit in the php.ini.
-- PHP manual, Runtime Configuration, description of max_execution_time
Many hosts run in safe mode. The other server is most likely one of them.
Edit: The same restriction is in place on set_time_limit
:
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.
-- PHP manual, set_time_limit
page
Solution 2
Does GoDaddy allow you to edit their remote PHP.INI file, or (achieving the same function) set those options at runtime? Many restrictive hosts (and I don't know this about GoDaddy one way or the other) won't let you futz with PHP options either via the config file or at runtime as you did on WAMP. It could be that though you're still calling that function, it's not being applied.
Use
echo 'Time Limit = ' . ini_get('max_execution_time') .
The manual says that if it's set at all in the PHP.INI, that will override this runtime. PHP Manual on set_time_limit
Solution 3
You can change max_execution_time.
Upload a 1 line (max_execution_time = 600) php5.ini to your root folder (where php.ini resides).
![Mickey](https://i.stack.imgur.com/46uah.png?s=256&g=1)
Mickey
Updated on July 09, 2022Comments
-
Mickey almost 2 years
If I do
set_time_limit(50)
orini_set('max_execution_time',50)
, then when I echoini_get('max_execution_time')
on my localhost i get50
, but when I do this on another server it echoes the default30
and completely ignores my request. Why is this? -
markus over 14 yearsrun something else, something shorter/easier against it and check the response.
-
Mickey over 14 yearsI'll give you the answer check but I just figured it out before i refreshed the page! ahhh! But then, wouldn't the script error out in 30 seconds? Why is it telling me "connection to server has been reset" any ideas?
-
Powerlord over 14 yearsAt a guess, PHP just closes the connection without finishing, hence the connection to server has been reset message. Out of curiosity, what operations are you doing that's taking longer than 30 seconds? There must be some way of cutting down on processing time unless you're doing a lot of work with XML or slow databases.
-
Mickey over 14 yearsI have to connect to multiple MLS providers via the RETS (rets.org) spec to get listing data. About 1k per listing, and ?k for about 5-12 raw images. I insert the data into MySQL then it goes to the next one, (in a loop). Then it has to geocode each listing and some other fancy non sense.