duan5731 2014-01-24 14:44
浏览 73
已采纳

wp-cron vs server cron(最长执行时间)

I would like to ask you about differences between wp-cron and server cron. Basically I have a php script which takes some minutes to complete. If I run it through browser, browser shows error something about timeout.

So I put it into server cron (paid hosting) and it is working.

I was trying set_time_limit... when was accessing through browser but it did not work...

Anyway I want to execute this script lets say every 2 weeks. I know that wordpress has wp-cron, but my question is it is good as server cron? Will it work for long time scripts?

Because of my point of view the wp-cron is initialized by user (browser) so it should apply limits in php.ini right?

Because it is paid hosting I can not modify a lot of options...

So what is the difference between these crons? Thanks

  • 写回答

1条回答 默认 最新

  • duanaozhong0696 2014-01-24 14:52
    关注

    Yes, wp-cron is initialized by the browser. Therefore, it will only execute for 30 seconds by default. Therefore, it is not meant for running scripts that may take longer than a few second.

    Server cron runs your script from the command line which does not have same time constraint. From everything you have said your script is a good candidate to run as a server cron.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度