Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

[SOLVED] [Warning] set_time_limit() [function.set-time-limit]: Cannot set time limit due to system policy


Reply

6 Posts   8434 Views

Avatar
hwi

1 February 2010 at 11:50am (Last edited: 2 February 2010 12:13pm), Community Member, 5 Posts

Hi
My settings is
php 5.2.12
silverstripe 2.3.5
Apache server
Linux srv38 2.6.18-6-vserver-amd64
Mysql

I get this warning/error :
when I do dev/build
when I try to view an uploaded image in "files view"
[Warning] set_time_limit() [function.set-time-limit]: Cannot set time limit due to system policy

Source

318 * @param $timeLimit The time limit in seconds. If omitted, no time limit will be set.
319 */
320 function increase_time_limit_to($timeLimit = null) {
321    if(!ini_get('safe_mode')) {
322       if(!$timeLimit) {
323          set_time_limit(0);
324       } else {
325          $currTimeLimit = ini_get('max_execution_time');
326          if($currTimeLimit && $currTimeLimit < $timeLimit) {
327             set_time_limit($timeLimit);
328          }
329       }
330    }
331          
332 }
333

Anyone got an idea what happens - made a local install on my machine which do not act like this - so I guess it a server setting - but I do not know where too look.

Thanks in advance

Avatar
OwenW

1 February 2010 at 4:45pm Community Member, 45 Posts

Hi hwi,

Have a quick look at this post;

http://silverstripe.org/installing-silverstripe/show/271972?start=0#post278079

The issue that he is seeing is the same.

Basically, the set_time_limit function is disabled in php.ini.

Hope that helps.

Cheers
Owen

Avatar
hwi

2 February 2010 at 1:06am (Last edited: 2 February 2010 12:15pm), Community Member, 5 Posts

Hi Owen

Thanks for your headsup on this issue. I will try my hosting company and see if they can set the settings for me.

Thanks again now I know what to ask for.
Cheers

EDIT UPDATE :::::::::::::::::::::::::

Thanks Owen it ended up that the host did not support set_time on their server. So I guess its time for a new hosting company.

Thanks for your time
Cheers

Avatar
HeresJohnyOrg

25 March 2010 at 10:38am Community Member, 1 Post

Hi,
is there no other way around this problem with set_time_limit than to change hosting company?
My hosting company is'nt keen on any changes in the php.ini file, so i guess it's a pretty common case.
It seems a bit narrow-minded of silverstripe not to offer a way around it.

I'm totaly new on silverstripe and just testing it out for fun, so i guess the big question from me is as following:
Is this warning message any thing to take notis of in the bigger picture?

//John, the optimist

Avatar
AKB

11 June 2010 at 8:51am (Last edited: 11 June 2010 8:52am), Community Member, 1 Post

I have the same problem, can anybody advice me on how to solve this issue. My Host can not change that for me, I run this ini_get('max_execution_time') only 30second is set. I see the silverstripe function try to increase to 600second in the function. Any idea?

Avatar
Matty Balaam

23 June 2010 at 1:04am Community Member, 69 Posts

I've managed to get around this problem on Fasthosts and Silverstripe 2.4 by amending the bottom of sapphire/core/core.php to

/**
* Increase the time limit of this script. By default, the time will
be unlimited.
* @param $timeLimit The time limit in seconds. If omitted, no time
limit will be set.
*/
function increase_time_limit_to($timeLimit = null) {
if(!ini_get('safe_mode')) {
if(!$timeLimit) {
} else {
$currTimeLimit = ini_get('max_execution_time');
if($currTimeLimit && $currTimeLimit < $timeLimit) {
}
}
}
}

?>

Your mileage may vary.