I got a cron job which creates products. There are many products, so the cron runs more than every 4 hours.

I create my products in batches of 250 and with paging. If I create every batch/page single wise, there is no error.

If I run the cron job as it should be (all product batches in row), then I get a timeout.

[27-Sep-2018 13:09:26 UTC] PHP Fatal error:  Maximum execution time of 240 seconds exceeded in /../magento/app/Mage.php on line 0

This is the file and line, where this error comes from, varies from time to time...

on top of my importer file I call this, because I hoped it would help...

ini_set('MAX_EXECUTION_TIME', -1);

php_ini max_execution_time is set to 18000... where does this 240 come from and how can I change it?


1 Answer 1


Your loop might be endless. If it is not, you could extend the maximum execution time like this:

ini_set('max_execution_time', 300); //300 seconds = 5 minutes

i hope this could help you.

  • it is not endless. It just takes some hours (13.000 products). I used ini_set('MAX_EXECUTION_TIME', -1); and it did not work.. so why should 300 work?
    – FloC3
    Commented Sep 27, 2018 at 14:49
  • I think your php.ini is over ridding your ini_set('max_execution_time','-1') function in magento/app/Mage.php. Can you verify it? Commented Sep 27, 2018 at 15:09
  • my php.ini is set to 12000 so there are no 240 seconds
    – FloC3
    Commented Sep 27, 2018 at 15:10
  • Create a file with <?php echo phpinfo(); ?> in, and visit the file. You can verify max execution time there Commented Sep 27, 2018 at 15:39
  • max_execution_time = 18000
    – FloC3
    Commented Sep 28, 2018 at 6:59

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.