How do we update files in production server while maintaining an old file to roll-back to?

Currently we are updating our live web server files by renaming the current server file to be like index.php-ddmmyy and then uploading the latest file.

We want to keep the old file in case bugs happened and we can easily roll-back to the old file.

Is this a good practice? If not, please suggest a better one.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

A better strategy would be to have your development server under version-control, and have a deployment script upload your development files whenever you want to release them to the public.
melwongAuthor Commented:
How do i put my dev server under version control? SVN in dev web server?
How about implementing VSS so you don't have to worry about renaming your file? You can just revert back to a point in time.
Protecting & Securing Your Critical Data

Considering 93 percent of companies file for bankruptcy within 12 months of a disaster that blocked access to their data for 10 days or more, planning for the worst is just smart business. Learn how Acronis Backup integrates security at every stage

How do i put my dev server under version control? SVN in dev web server?

Yes, version control your dev web server.
I'm using git myself.
Ben Personick (Previously QCubed)Lead Network EngineerCommented:
From an administrative perspective we create ZIP archives of the entire WWW root with it's version number, then deploy the new code into the site.

Similar Idea, pretty easy to maintain, but SVN is also a valid method, of course then you may have additional services on your web server which isn't the best if you can avoid it.

Ray PaseurCommented:
Many of my colleagues use GIT and PHP has recently moved to GIT.  See the notes here:

My advice is to have version control on your local server, NEVER on the production server.
Then you just write a deployment script that you run each time you want to release your last version from the local server to the production server.
Ben Personick (Previously QCubed)Lead Network EngineerCommented:
yeah, I wasn't sure if you wanted it one way or the other.

As I said it's a similar concept, since I write a script to zip the old sit up, date it, and then copy the new files into place.

What I've found is that we end up making quick tweaks to code on the fly to fix minor problems and that it is not necessarily anything which needs to be captured in SVN, connection strings and server names are often different, etc, or a slight typo made it through QA, and you have to change in prod before you do anything.

Not sure if all that would have to be managed through the SVN or still by hand in your method, but I think the result is essentially the same.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
well... I guess it all depends on your need for history and accountability of the changes to the codebase.
You might want every change logged, or not.
I'm partial to having everything logged, so as to stick it in the face of those few individuals who sometimes try my patience...
melwongAuthor Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.