简体   繁体   English

Cron在一段时间后中断。[处理此指令时发生错误]

[英]Cron is breaking after certain amount of time.[an error occurred while processing this directive]

I am working on a script where I need to find if there's and updation on page went on Job URLs in my database. 我正在处理一个脚本,该脚本需要查找数据库中的Job URL上是否有页面更新。 ie if any job is posted/page updated etc for the pages which have their URLs stored in my database. 即,如果发布了任何作业/页面更新等,这些页面的URL已存储在我的数据库中。 I am trying to fetch headers of those pages and checking if their last-modified date is more than stored in my database or content-length is more or less than stored in my database (once i fetch the last modified date and content -length and when script run again it compare records for each URL) 我试图获取这些页面的标题,并检查它们的上次修改日期是否大于数据库中存储的内容,或者content-length是否大于或小于我数据库中存储的内容(一旦我获取了上次修改的日期和content -length和当脚本再次运行时,它将比较每个URL的记录)

The script is working fine on my local but the problem is when it run on bluehost server it is breaking after uncertain record or amount of time and showing error [an error occurred while processing this directive]. 该脚本在我的本地服务器上运行良好,但问题是当它在bluehost服务器上运行时,在不确定的记录或时间量后中断,并显示错误[处理此指令时发生错误]。 (Its when i try to trigger script from my browser.) and when I let it run from Cron it never return anything (I have added a script to send me a mail once the script run fully. with or without errors. I am bypassing the errors if any in-case script is not able to make updation in record (which is around 15 records). (当我尝试从浏览器触发脚本时),当我让它从Cron运行时,它永不返回任何内容(我添加了一个脚本,一旦脚本完全运行就向我发送邮件。如果任何情况下的脚本都无法更新记录(大约15条记录),则会发生错误。

Any one know what could be the error? 有人知道可能是什么错误吗? I was earlier using wget --delete-after command and now using php -f and my cron is on dedicated IP. 我之前使用wget --delete-after命令,现在使用php -f,而我的cron位于专用IP上。 Execution time could be around 15-20 min. 执行时间大约为15-20分钟。

PHP configs do have provisions for max execution time and also resources they are permitted to use eg max memory. PHP配置确实规定了最大执行时间以及允许使用的资源,例如最大内存。

You can set these programatically. 您可以以编程方式进行设置。

See http://www.php.net/set_time_limit http://www.php.net/set_time_limit

It is not possible to set the limit beyond the environment max_execution_time - that is set in the php configs. 无法设置超出环境max_execution_time的限制-在php配置中设置。

If you are on a shared server - these limits are often set quite aggressively to ensure resources do not get monopolised. 如果您使用共享服务器-通常会非常激进地设置这些限制,以确保资源不会被垄断。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM