I am running a script which Fetches the data from other site like Articles of a user and other things also. I run my script in hook_cron. Cron gives me this error after a while of script running.

Cron run exceeded the time limit and was aborted.

Also I don't have access to change php.ini and setting.php. How can I change max_exec_time value.

  • If you don't have access to anything that can change the max execution time, then you can't really change the max execution time. Have you tried the Batch API for your cron tasks? Might be worth splitting the task up to prevent timeouts.
    – Chapabu
    Dec 17, 2012 at 15:49
  • There's some more advice for using the Batch API in hook_cron here.
    – Chapabu
    Dec 17, 2012 at 15:50

3 Answers 3


Seeing as you don't have access to anything that allows you to change the max execution time (and I would imagine if you find a workaround that it won't work if your server is this locked down) I see a couple of options.

1: Utilise the Batch API as I mentioned in my comment (Batch API docs are here)

2: Check out Elysia Cron to split your cron tasks up into smaller, more manageable chunks.

Elysia Cron extends Drupal standard cron, allowing a fine grain control over each task and several ways to add custom cron jobs to your site.

  • This is a much better idea than the nonsense I was spouting :)
    – Clive
    Dec 17, 2012 at 15:54
  • 1
    I know this from personal experience :p On my live box if I try to change anything with ini_set outside of settings.php or php.ini then it won't actually work :(
    – Chapabu
    Dec 17, 2012 at 15:57
  • @Chapabu I can't use Elysia Cron with poorman cron. Because Most of things are setup with poorman cron. I will check the Batch API. I didn't know anything about batch api so I have to read it first. Dec 17, 2012 at 15:58
  • @Sumit Drupal also has built-in queue handling for cron jobs, check out hook_cron_queue_info()
    – Clive
    Dec 17, 2012 at 16:00
  • @SumitMadan That's a shame. Apparently Ultimate Cron works with Poormanscron, but I've never tried it, so I can't offer anything else other than the name.
    – Chapabu
    Dec 17, 2012 at 16:02

.htaccess is another option for increasing max_execution_time, if you have access to that. See https://stackoverflow.com/questions/7739870/increase-max-execution-time-for-php.

  • not have access Dec 18, 2012 at 6:21

Contacted to my client and get Access to files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.