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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

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

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

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


Go to End


6 Posts   14828 Views

Avatar
hwi

Community Member, 5 Posts

1 February 2010 at 11:50am

Edited: 02/02/2010 12:13pm

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

Community Member, 45 Posts

1 February 2010 at 4:45pm

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

Community Member, 5 Posts

2 February 2010 at 1:06am

Edited: 02/02/2010 12:15pm

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

Community Member, 1 Post

25 March 2010 at 10:38am

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

Community Member, 1 Post

11 June 2010 at 8:51am

Edited: 11/06/2010 8:52am

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

Community Member, 74 Posts

23 June 2010 at 1:04am

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.