Jump to:

23483 Posts in 18976 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » [SOLVED] [Warning] set_time_limit() [function.set-time-limit]: Cannot set time limit due to system policy

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

Page: 1
Go to End
Author Topic: 8298 Views
  • hwi
    Avatar
    Community Member
    5 Posts

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

    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

  • OwenW
    Avatar
    Community Member
    45 Posts

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

    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

  • hwi
    Avatar
    Community Member
    5 Posts

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

    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

  • HeresJohnyOrg
    Avatar
    Community Member
    1 Post

    Re: [SOLVED] [Warning] set_time_limit() [function.set-time-limit]: Cannot set time limit due to system policy Link to this 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

  • AKB
    Avatar
    Community Member
    1 Post

    Re: [SOLVED] [Warning] set_time_limit() [function.set-time-limit]: Cannot set time limit due to system policy Link to this 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?

  • Matty Balaam
    Avatar
    Community Member
    69 Posts

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

    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.

    8298 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.