douping1993 2014-02-18 20:46
浏览 81
已采纳

在没有Windows任务计划程序的Windows中执行PHP脚本的好方法

I am creating a web app that requires a job scheduling function for intranet on a Windows server running Apache/PHP/MySQL. For now, we have been executing perl and PHP via .bat files using the built in Windows task scheduler. I would like the scheduling function to be more tightly embedded into the app and not have to utilize the Windows task scheduler. I am considering having a program written that would run as a service to manage the execution of the jobs (service would look at the jobs which would be defined and stored in a MySQL database).

Can anyone speak to this approach and recommend best way to accomplish this?

  • 写回答

1条回答 默认 最新

  • doudao7113 2014-02-18 20:50
    关注

    In my opinion there is no real good solution to this. I have done in the past as you have and written a service to manage these sorts of cron jobs but to be honest, I ended up writing the required task not in PHP but in C or C++ as it worked out faster in the actual service itself... thus decoupling app and regular task even more. Even on Linux you would put the task in as a cronjob which is the same deal as task scheduler.

    The best approach I have come up with ? I actually had my PHP script (using exec) create the scheduled task so that when I deployed to a new server it happened automatically and was sort of (read very slightly) coupled with the app. And it involved no compiled code either... keeping with the scripted nature of PHP.

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

报告相同问题?

悬赏问题

  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料