开发者

Global php.ini of my shared server limits cronjob to max_execution_time to 30 seconds cannot import large file

i am tring to set up a cron job which import into my database products and categories, i have already the script doing this job but my host compay has limited cron GLOBAL max_execution_time to 30 seconds, this not apply for USER php.ini where max_execution_time is already set to 4000. (browser request) For this reason when i run the script via browser i successfully can import up to 5000 products without getting any timeout, but if i use cron it stops after 30 seconds and import just 400 products. I tried to put ini_set ('max_execution_time... xxx it doesnt works, the server limitation blocks the script after 30 seconds. I cannot cut the file in many little ones because this file is updated everynight, would be crazy to do this all days. I can run more jobs 30+30+30 but since the script HAS to replace the old products quantity or details with new o开发者_Go百科nes i cannot tell him to dont override the existing products. I am getting crazy about this, it's extremely important that the products are updated every days and we cannot do this manually. Since we wont buy a VPS or DS just to load a 2mb file, what other kind of solution could we try? how we can bypass this limitation? can i schedule the cronimport.php in some other way instead of using cron, or maybe calling it with cron tru another script? really confused :) I am sorry for my poor english.

Thank you!


If this is mission-critical functionality, first and foremost, I'd look for somewhere to host it that doesn't impose such limitations.

Where are the products and categories coming from? What's the essence of your script's functionality? Can you summarise?

When a cron job has a limited window to execute, the general rule of thumb is to only feed it a little bit at a time, ie give it ten rows to process, and mark those rows as processed, so the next cycle picks up where it left off. If you can't extend your time limit, you'll need to find a way to do this. Tell us what your code is actually doing, and perhaps we can suggest a way.

Cheers,

n.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜