上传重要文件时网站无法运行

发布于 2024-08-24 01:57:44 字数 170 浏览 5 评论 0原文

我在维护基于 php 的网站时遇到问题。我的网站是基于 Zend 框架构建的。当我希望在线上传新副本或版本时 - 在上传期间,尤其是在上传和重写模型和控制器等关键文件时 - 该网站将无法正常运行。

有没有办法上传网站而不必经历这个问题?

我的更新真的很规律。在这种情况下,我们可以说每周一次或两次。

I have a problem with maintenance of my php based website. My website is built on the Zend Framework. When I wish to upload a new copy or version online - during the time of upload especially when crucial files like models and controllers are being uploaded and rewritten - the site won't run understandably.

Is there a way to upload a website without having to go through this issue?

My updates are really quite regular. Let's say like once or twice a week in this case.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

夏尔 2024-08-31 01:57:44

您可以利用即使通过 FTP 也可以快速轻松地重命名目录这一事实。我通常做的是:

  1. 有两个目录,website_livewebsite_upload

  2. website_live 包含实时网站(显然)

  3. 将内容上传到 website_upload

  4. website_live 重命名为 website_old (或其他名称)

  5. website_upload 重命名为 website_live

完成!如果您快速重命名,停机时间不到两秒。

如果您在旧版本(例如从 CMS)中上传了内容,并且需要将其转移到新版本,那么情况会变得更加复杂。每次都手动执行很麻烦,但基本上也只是简单的重命名操作(在 FTP 中重命名也毫不费力)。

使用简单的部署脚本可以很好地实现此任务的自动化。如果您使用的是 Linux,则为此设置 shell 脚本很容易。在 Windows 上,我使用过一个非常好的工具来进行自动 FTP 同步、重命名和错误处理 - 即使非技术人员也可以开始该过程 - 是 ScriptFTP。它配备了良好的脚本语言和良好的文档。但它不是免费的。

如果您希望进入核心自动化 PHP 部署,我最近一直在该领域进行一些研究。也许是我最近的赏金问题的答案可以给你灵感。

You can make use of the fact that renaming directories is quick and easy even through FTP. What I usually do is:

  1. Have two directories, website_live and website_upload

  2. website_live contains the live website (obviously)

  3. Upload contents to website_upload

  4. Rename website_live to website_old (or whatever)

  5. Rename website_upload to website_live

done! Downtime less than two seconds if you rename quickly.

It gets a bit more complex if you have uploaded content in the old version (e.g. from a CMS) that you need to transfer to the new one. It's cumbersome to do manually every time, but basically, it's just simple rename operations too (renaming works effortlessly in FTP as well).

This is a task that can be automated quite nicely using a simple deployment script. If you're on Linux, setting up a shell script for this is easy. On Windows, a very nice tool I've worked with to do automated FTP synchronizing, renaming and error handling - even with non-technical people starting the process - is ScriptFTP. It comes with a good scripting language, and good documentation. It's not free, though.

If you're looking to get into hard-core automated PHP deployment, I've been doing some research in that field recently. Maybe the answers to my recent bounty question can give you inspiration.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文