3

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 ar ebeing 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. Lets say like once or twice a week in this case.

peterh
  • 9,698
  • 15
  • 68
  • 87
Ali
  • 6,940
  • 20
  • 97
  • 155

1 Answers1

7

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.

Community
  • 1
  • 1
Pekka
  • 418,526
  • 129
  • 929
  • 1,058