2012-12-10 12:06
浏览 126


I've built a PHP script that creates/restores a backup containing a sites content and database. It works really well on smaller sites but it runs into trouble on larger sites. What would be the best way to batch a script like this? Basically, it copies files from one directory to another, creates a DB dump and then zips the directory.

I've done a little bit of research, do I need to use cron jobs?

图片转代码服务由CSDN问答提供 功能建议

我已经构建了一个PHP脚本,用于创建/恢复包含网站内容和数据库的备份。 它在较小的网站上运行良好,但在较大的网站上遇到麻烦。 批处理这样的脚本最好的方法是什么? 基本上,它将文件从一个目录复制到另一个目录,创建数据库转储然后压缩目录。


  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dongren4758 2012-12-10 13:44

    If it is something that happens at a fixed time / schedule, then it should be a cron job. This is fairly straightforward to set up. There are plenty of tutorials.

    If, on the other hand, it is an action a user triggers from a web browser, you should fork and exec. You take in the user's input, fork and exec and then let the user know that he will be emailed when the process is complete.

    解决 无用
    打赏 举报

相关推荐 更多相似问题