As I expand on different website changes I'm trying to find a better and safer alternative to my current testing.domain.com and FTP solution. My goal is to put the site in revision control (probably Git due to its excellent branching and tagging ability) and still be able to view my dynamic site (PHP) in real time along with clients.

So for some questions

  1. Is there any free or very cheap software that does this already? I don't want to reinvent the wheel.
  2. What would be the best way to implement version control in this setup? Use the testing folders on the server as a git repo? Sync the dev and local copies and use local as a repository? Do I make the whole site (production and dev) a repository?
  3. How can I sync dev and production?

You'll probably want to branch your code or at the very least start using tags. I prefer the branch method so I can keep 2 copies of the site. One being my trunk version ( dev ) and another being the live production copy. Then I can just merge the changes to the production branch when I'm ready to publish and if something goes wrong on production I have a current 1 for 1 match with production I can work on to fix.

As for the dev server part. I often use a subdomain of "QA.example.com" and restrict all access by IP to it. This way if I need a 3rd party to see it to proof something before it goes live, I can add their IP range.

Since you're using a database with your PHP site ( I'm assuming this since you mentioned it's dynamic ), you might also want to make a copy of the database and rename it with a suffix like 'dev' so that you can edit it without effecting production in your QA environment. It's fairly easy to export a DB and just insert it into another with a different name if you're doing it from scratch each time. I actually have a script through Hudson that allows me to do a simple backup from my production DB and then drop my QA DB and replace with the production copy.

  • 1
    Sorry, I've forgotten about this question. This is actually what I ended up doing (Git for a while, then Mercurial). This has immensely helped me out and makes things so much easier and safer. I've even made it so that when I push the website updates itself. +10 – TheLQ Jan 10 '11 at 22:49

I have development server on my notebook, there is git repository too. The configuration is quite similar to production server. If I need synchronize, I just upload all source files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.