Xoops Site Migration

Date 2005/1/19 1:51:06 | Topic: XOOPS

Original ImageAs I found out recently, migrating a Xoops website from one server to another can be a daunting task to a new user.

But after doing it once, I now feel that if I need to make the move again, I can do it faster, easier and more efficiently than before. I would like to thank all the Xoops users that posted their tips on this subject in the faq. It help immensely. Out of this article I will be pulling parts to add to the faq some points that I felt was not enough information on.

So read on to my guide to site migration, with no access to the command line.

First off a little background on my reasons for my site move.

For me speed was the major issue. My former hosting company American Hosting I had no issues with. Uptimes were always great (over four years of use). I would recommend them to anyone that needs a cheap dependable hosting service.

But with my move to Xoops came new challenges. As I added modules my database queries went up along with the load time of my pages. Sometimes over six seconds with a cable connection. During the time that they made backups (once every evening, another thing that I liked of there service) my page loads sometimes went to over 45 seconds. So I could see the point that their hardware just could not handle the load of the websites on the shared server.

My solution. Well it happened kind of by accident. I was hanging out over at the Xoops forums when I saw a post titled Fastest MySQL hosting - Check out our Xoops demo!. I read the ad post, went to the site to check the demos (which were impressive, although barebones) clicked on the order/info link and got a 404 error page. Gave me a chuckle and I posted my feelings on the board, and others followed. I did not expect to see the advertising poster return, but he did. He offered, because of his blunder, double space on his servers.

At the time I still was not ready to bite. I emailed him and asked for more information, which was replied almost immediately. I did some research on the company, and the person. Found him posting on a lot of forums but mostly for his parent company Perfect10 hosting. The reviews of this company, and to find that the owner was the same guy, got me interested in his offer. So I ordered one month, which I am currently using.

Two things to remember about hosting companies is, do your research before commiting, and don't lock yourself into more than one month (even though you can save a few dollars by ordering for a year). Get the feel of the service, then if it is still to your liking sign up for more.

OK. Enough of my history lets get to migrating the website.

The first thing that you want to do, and should even do this when not migrating, is download an updated exact copy of your website with full directory structure intact. You can easily do this with your favorite FTP program.

I also, in cPanel (my preferred control panel) do a full site backup, database backup, and a home directory backup. This can be accomplished in cPanels backup utility. The home directory and the database backup will download to disk automatically in gzip format. The full site backup will be created and is found in your website's home directory. Use an FTP program to download it.

Why the three types of backups? Redundancy, if something goes wrong I can restore the full site or part of it easily in the cPanel backup utility restore function.

So we now have our website copied to disk, and our backups. We now need to upload all website files to the new servers root directory, with exact directory structure intact. Once this is done check all your folder permissions and adjust as required. For certain the uploads, template_c and the cache folders should be chmod 777, but also other folders required by modules also need to be adjusted to writable.

Next we need to work on the database.

For this I read all information in the Xoops faq plus searched the internet for all information I could find. The preferred method is using the MySQL cli to install the database through the command line.

But I had a problem.

No cammand line interface to the site. That left me with one option, PHPmyadmin.

The only problem with restoriing, or installing a database with PHPmyadmin is the script timeout error. PHPmyadmin can load small databases with no trouble, but if you have a larger database, more than 2.5 to 3MB the operation will time out. My database is a little over 7MB so there was no way for me to install the full database with PHPmyadmin.

OK. So I have 144 tables with 7 mb of information. How would I get this database installed?

The solution was to break the database up into smaller chunks and install it a piece at a time.

I logged in to PHPmyadmin on my former site and exported sections of the database keeping whole module sections intact. In all I divided the database up into seven 1MB chunks. Had seven folders on my local computer named , restore1, restore2 and so on.

When you export from PHPmyadmin check the following options in the export options: SQL, Add DROP TABLE, Add AUTO_INCREMENT, Enclose table and field names with backquotes, Use hexadecimal for binary fields, set the export type to INSERT, set the filename template to _DB_, and tick to export in "gzipped" format. Select the tables that you want to export (hold down the CTRL key while clicking multiple tables for export.)

Next I logged in to PHPmyadmin on the new site and installed each table chunk to the database. To do this click on the SQL tab, click on browse, a file browse window appears, locate and select the file then click the go button. The file will be uploaded then installed to the database. Once completed PHPmyadmin will give you a success or failure screen with the number of operations performed.

Once all of the tables are installed click on the Structure tab, scroll to the bottom, click on check all (which just puts a check mark by all tables). There is a dropdown list titled With Selected, click on that and select Analyze Table. You will probably get many error messaged here about primary keys and such.

Click the Structure tab again and click on Check All. Go back to the dropdown list and select Repair Table. All tables should be listed with an "OK" by them.

So now we have the website and the database installed. Now we need to configure mainfile.php.

The permissions settings for mainfile.php should be OK by default for what we want to do now. Get out your favorite text editor open the copy of minfile.php in your site copy on your local computer. Check the entries for :

// XOOPS Physical Path
// Physical path to your main XOOPS directory WITHOUT trailing slash
define('XOOPS_ROOT_PATH', 'var/www/html/yourURL.com/yourxoopsfolder');

// XOOPS Virtual Path (URL)
// Virtual path to your main XOOPS directory WITHOUT trailing slash
define('XOOPS_URL', 'http://www.yourURL.com/yourxoopsfolder');

And make any necessary changes. then check all your database information entered in the file, and make any necessary changes.

Copy mainfile.php to your new server replacing the original. Use the cPanel File Manager utility and chmod mainfile.php to 0444. This make this file read only.

Now the only thing left to change is the DNS setting of your domain name. You should have been provided with a primary and secondary DNS server hostname or IP address by the hosting provider. Go to your domain name providers control panel and change the pointers to these provided servers.

It will take some time, usually several hours to one day for the new DNS settings to propagate throughout the internet. At that time your domain will go to the new site location instead of the old one. The old site can be taken offline anytime after the change is made.

I know this was a long article, but, if you are still reading let me know if I explained this procedure well or not. Anything that I may have left out please comment.

This article comes from WarPigW2.com

The URL for this article is: