Moving entire site to new server?

Please post all install related problems here. Visit this forum first for troubleshooting.
Post Reply
wptzmike
Posts: 4
Joined: Mon 8. Nov 2004, 22:43

Moving entire site to new server?

Post by wptzmike »

OK...
I have setup a decent site that is a work in progress for my company.

The hard part (for me) is now I need to move it to a production server....

I have not tried the move yet but I am guessing that it will consist of a mysql dump and a tar of the webserver...

Is this all?
Peekay
Posts: 286
Joined: Sun 25. Jul 2004, 23:24
Location: UK

Post by Peekay »

Yes. I would like some advice on this too. I also want to 'copy' my test site, but there has been a (minor) version release since I built it. I would like to install the latest version on my other server, then transfer articles, site structure etc. How do you do that? :?:
darkknight
Posts: 13
Joined: Sat 2. Oct 2004, 15:45
Contact:

Post by darkknight »

Hi

I recently moved a site from my dev server to a production server. Here are the steps I followed:

1) the hardest part was the mysql dump. You can get phpMyAdmin to provide a compressed archive quite easily. But, the problem for me was the condition of the dump. Various entries in the database are entered sequentially based on an auto increment. The dump I got from phpMyAdmin produced records that were not always sequential.

I had a further problem with the dump and this more serious. Record values were not always dumped in a form that were usable without a lot of editing. For example, image attributes such as height='50' and border ='0' would be dumped as height=''50'' and border = ''0'' rather than height =\'50\' and border = \'0\'. This meant that I had to go through each line of the dump and manually edit the entire dump. Not much fun.

I tried a number of other db dump apps but nearly all were based on the code used by phpMyAdmin - except one. A.M.B.T. at ambt.sourceforge.net dumps the db tables perfectly. The app is on the raw side and needs some additional features (such as compressing the dump and emailing it to a designated address so it con be used as a backup tool), but it meets the primary requirement perfectly.

I then did some basic 'search and replace' editing of the dump to enable me to install the db via a php file rather than an sql file. That is, I add to each line of the dump $query[] = "....";. Then I add a db connection at the top of the dump and a for loop at the bottom.

If you have a lot of records in your database, you may want to break the dump - php script into several parts. The site I was move had around 44,000 records and I broke it into four parts.

Check for any code entries in the dump that refer to the original site such as 'http://localhost/...' and edit accordingly.

FTP the dump.php file(s) to the production server and run the dump.php script via the web browser

2) Next, create an archive of the files on the original site. Zip is ok; a gz'd tar is better as it is smaller. Upload the archive to the production site. If you have shell access, uncompress the archive. If not, get the ISP administrator to do it for you.

3) Delete the archive as it is just taking up room.

4) Your site is now operational on the new server. But check it out in case you missed some links still referring to the old site.

Done. 8)
2 + 2 = 5 for really large values of 2
Peekay
Posts: 286
Joined: Sun 25. Jul 2004, 23:24
Location: UK

Post by Peekay »

Thanks for such a detailed reply. Do you think after using the A.M.B.T utility to get the data, you could then successfully use the SQL file to install the DB if it isn't too large? I mean, was your decision to use PHP simply due to the number of records involved :?:
darkknight
Posts: 13
Joined: Sat 2. Oct 2004, 15:45
Contact:

Post by darkknight »

Yes you can use the sql file if you have shell access. However, sometimes shell access is not available from the ISP for security reasons. So, I now just convert the sql file to php and bypass the shell access issue.
2 + 2 = 5 for really large values of 2
User avatar
pSouper
Posts: 1552
Joined: Tue 11. Nov 2003, 15:45
Location: London
Contact:

Post by pSouper »

for a nice sql database sync-ing tool you could do worse than SQLyog @ http://www.webyog.com
wptzmike
Posts: 4
Joined: Mon 8. Nov 2004, 22:43

Many Thanks...

Post by wptzmike »

This should be organized, checked and submitted as a how-to...
I can't believe it is all that uncommon to do work on a server other than your production server.

Once again, many thanks for the time and effort....open source and open minded people RULE!
Post Reply