Move OSCommerce to a new server/host guide
Moving your OSCommerce website to a new host can be quite daunting if you are not familiar with terms like FTP and MySQL. This can be frustrating if the server you are currently on is running slow and you are losing sales. The good news is that with the right guide (like the one below) anyone can move an OSCommerce site to a new server with ease. We have created the below guide and listed every (and we do mean every!) step in detail. So strap on your OSCommerce seatbelt, it's time to move servers!
The approx time it will take to follow the guide if you are new to servers/hosting etc is 1 hour.
Moving OSCommerce hosting checklist
Before moving OSCommerce to a new hosting company, you will need the following:
- FileZilla or an alternative FTP program.
Using this guide, you will be uploading and downloading a lot of files via a FTP program called FileZilla (avaliable for free at https://filezilla-project.org/download.php?type=client). You can use another FTP program if you wish but the below guide will have screenshots of where to click etc using FileZilla.
- Set OSCommerce into maintenance mode.
Although this isn't mandatory, it is advised. When you move servers there will be a 48 hour gap where users may still be able to load your old hosting (this is whilst the DNS changes update). As they can load your old hosting, they can also purchase items. These purchases will not show up on your new hosting. By putting your site into maintenance mode, no orders can be placed on the old hosting. See http://addons.oscommerce.com/category?search=down+for+Maintenance for the "down for maintenance" add-on.
- New hosting set up with your domain as a reference
To do this with Squirrel Hosting visit http://squirrelhosting.co.uk/domain-needed and enter your domain in the option 2 box. Then order hosting during the checkout.
Right, lets get started.
OSCommerce Transfer Sections
We have split the below guide into the following sections
- Backup your old website + database : Automatic way
- Backup your old website + database : Manual way
- Update your nameservers.
- Uploading your OSCommerce files to a new server.
- Create and import your OSCommerce database
- Update your includes/configure.php and admin/includes/configure.php
- Update your OSCommerce file permissions.
- Update your domains nameservers
Step 1a : Backup your old website + database : Automatic way
Some hosting companies provide an automatic backup feature (ourselves included) which can backup your website and your database for you. If yours has this, we suggest using it and skipping to step 2. If yours doesn't have this, don't worry we've listed all the steps below needed to backup your site's files and databases.
Step 1b : Backup your old website + database : Manual way
First off, we will back up your website files. On your computer, create a folder called 'Old Website' then open up FileZilla (or an alternative FTP client). You will need to enter your FTP Host, FTP Username, FTP Password and possibly FTP Port number across the top and click Quickconnect. You will need to contact your current host for your FTP details (these are often in a welcome e-mail or in your hosting control panel).
FileZilla will now connect to your FTP and display all the server files in the 'Remote Site' box on the right. We will now need to find your OSCommerce files. These can usually be found in the public folder (the folder accessible via the web). This is usually called 'public_html' or 'htdocs'. Once you have found this folder, double click it to open it to view your site's files.
If you have installed your OSCommerce store into a sub-folder e.g. yourwebsite/store then you will need to look for a folder called store.
TIP : look for the files index.php, logoff.php create_account.php. Once you see these you are in the correct location.
To download the files to your computer, you need to highlight them all. To do this on a PC, simply click one of the files e.g. index.php then press the CTRL+A keys together. All the files should now become highlighted. Next, you need to drag the files over your 'Old Website' folder. To do this left click and hold down on one of the files, move the mouse over the 'Old Website' folder then release left click.
You will see a lot of transfer text appear at the top of FileZilla.
Once this has finished you will have a full backup of all your files on your computer.
Now we need to back up your database. This is where all your products, prices and customer details etc are stored. To do this, you will need to ask your current host for details on how to access your phpMyAdmin.
Once logged into phpMyAdmin click on your database from the left menu (depending on how your host has this set up you may already be viewing your database and as such won't need to do this step).
You should now see your database tables on the right.
Click the 'Export' tab at the top of the page.
Click the 'Custom - display all possible options' button and make sure all the tables are selected (if not, click 'Select All').
Next to 'Compression', choose 'gzipped' or 'zipped' from the dropdown (doesn't really matter which).
Scroll down to the bottom and click 'Go' then save the database to your computer somewhere safe (you will need this later).
Step 3 OR Step 8 : Update your nameservers.
This step is optional at this point but will need doing later in step 8 if you choose not to do it now.
You will need to update your domain's nameservers to point to your new hosting if you are keeping the same domain name (domain name = www.yourdomain.co.uk). This can usually be done via your domain control panel with your current registrar. If you are moving to Squirrel Hosting, you will need to ask your current registrar to update the nameservers on your domain to the ones listed here.
If you choose to update your nameservers now (instead of later) you will be able to access your hosting without using the host's IP. It will also mean you can view your site live straight after you finish this guide. This will result in a little downtime whilst the nameserver changes udpates (can take up to 48 hours).
If you are using us for your new hosting then you can put off this step as we cover connecting via your IP below.
Step 4 : Uploading your OSCommerce files to a new server.
OK, so now you have all your files backed up, the next thing you need to do is upload them to your new hosting. If you are using us (Squirrel Hosting) for your web hosting then you can follow this guide exactly. If you are using another host then you will need to contact them to find your FTP Login details and details on how to create + access a MySQL database.
Open up FileZilla and enter your FTP details (of your new hosting) in the top bar. Squirrel Hosting customers check your welcome e-mail for your FTP details (including FTP host IP address). You will also need to unlock your FTP via the eXtend control panel (contact us if you need help with this).
If you did not update your nameservers in step 3, you will need to enter your server's IP address as the host.
Next, double click on your public folder usually public_html or htdocs (Squirrel Hosting customers- double click public_html).
Next, open up your 'Old Website' folder on your computer and highlight all the files in the folder (CTRL+A). Left click on these files and drag them onto your public folder in FileZilla (Public_html).
You will now see all your files being uploaded to your server in the status bar at the top.
Once all the files have been uploaded (look at the bottom pane for for successful and failed transfers). You are ready to create and set up a database. Do not close FileZilla as you will need to come back to this afterwards to update some permissions and your configure.php files.
Step 5 : Create and import your OSCommerce database
The next thing you will need to do is create a new database on your new hosting and import your old database into it. Squirrel Hosting customers can follow the guide exactly below. Non-Squirrel customers will need to contact their new host to ask them for details on how to create a database and how to access phpMyAdmin (then skip below to the phpMyAdmin section).
Squirrel Hosting customers need to log into their eXtend control panel and click the MySQL Databases icon.
Next, enter your desired username and password for your new database, then click the 'Create' button.
Now you have the database created, you need to import your tables from your old database. Click the manage button next to your new database to load up phpMyAdmin.
IMPORTANT : Make a note of your username and password displayed at this step as you will need it later.
In the phpMyAdmin window, click your new OSCommerce database from the menu on the left.
You will now see an empty database page (usually with the message 'No tables found in database'). Click the 'Import' tab at the top.
Click the 'Choose File' button and select the database you backed up in step 1a or 1b. Then click the 'Go' button.
You should now see an 'Import has been successfully finished' message.
TIP: If you get an error message when importing your OSCommerce database then you will need to drop any tables that have been created and make a backup of your database as show in step 1B. Then retry the import above.
Step 6 : Update your includes/configure.php and admin/includes/configure.php
Now we need to update your configure files to show the correct database settings and the correct path.
In FileZilla (if you closed it, re-open it and connect to your new hosting), open up the includes folder.
Right click on confirgure.php and click 'View/Edit'.
TIP : If you are unable to open the file this way, drag it onto your PC and then drag it back to upload it when you are finished doing the below changes.
This will now open the file for editing. (Make sure the file is opened in a plain text editor such as notepad NOT Wordpad or Word! This will corrupt the file). You should see the below.
Change the below line to the full path of where your site is stored. For Squirrel Hosting customers, your full path will be the one below assuming your OSCommerce site is in your public folder, not a sub folder e.g. yourdomain.com/shop. If it is in a sub folder, add the folder name to the end (keep the trailing / at the end). Replace yourdomain.co.uk with your own domain name.<?php define('HTTP_SERVER', 'http://yourdomain.co.uk'); define('HTTPS_SERVER', 'https://yourdomain.co.uk'); define('ENABLE_SSL', false); define('HTTP_COOKIE_DOMAIN', yourdomain.co.uk'); define('HTTPS_COOKIE_DOMAIN', 'yourdomain.co.uk'); define('HTTP_COOKIE_PATH', '/'); define('HTTPS_COOKIE_PATH', '/'); define('DIR_WS_HTTP_CATALOG', '/'); define('DIR_WS_HTTPS_CATALOG', '/'); define('DIR_WS_IMAGES', 'images/'); define('DIR_WS_ICONS', DIR_WS_IMAGES . 'icons/'); define('DIR_WS_INCLUDES', 'includes/'); define('DIR_WS_FUNCTIONS', DIR_WS_INCLUDES . 'functions/'); define('DIR_WS_CLASSES', DIR_WS_INCLUDES . 'classes/'); define('DIR_WS_MODULES', DIR_WS_INCLUDES . 'modules/'); define('DIR_WS_LANGUAGES', DIR_WS_INCLUDES . 'languages/'); define('DIR_WS_DOWNLOAD_PUBLIC', 'pub/'); define('DIR_FS_CATALOG', '/home/sites/yourdomain.co.uk/public_html/'); define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'download/'); define('DIR_FS_DOWNLOAD_PUBLIC', DIR_FS_CATALOG . 'pub/'); define('DB_SERVER', 'localhost'); define('DB_SERVER_USERNAME', 'OLD-DATABASE-USERNAME'); define('DB_SERVER_PASSWORD', 'OLD-DATABASE-PASSWORD'); define('DB_DATABASE', 'OLD-DATABASE-NAME'); define('USE_PCONNECT', 'false'); define('STORE_SESSIONS', 'mysql'); define('CFG_TIME_ZONE', 'Europe/London'); ?>
You may also need to edit the cookie path:
On shared servers this is usually / but contact your host to make sure (Squirrel Customers use /).
Next, you need to edit the database details:
define('DB_SERVER', 'localhost'); define('DB_SERVER_USERNAME', 'OLD-DATABASE-USERNAME'); define('DB_SERVER_PASSWORD', 'OLD-DATABASE- PASSWORD'); define('DB_DATABASE', 'OLD-DATABASE-NAME');
- localhost = replace with your server host. Ask your hosting company for this. It's usually localhost (Squirrel Hosting customers, use localhost)
- OLD-DATABASE-USERNAME = Replace this with your new database username (see step 5 above).
- OLD-DATABASE-PASSWORD = Replace this with your new database password (see step 5 above).
- OLD-DATABASE-NAME = Replace this with your database name (Squirrel Hosting customers, this is the same as your username).
Once you have made these changes, save the file and go back to FileZilla. It will ask you to upload the the changed file, click 'Yes'. (If you download the file to edit on your PC instead then upload it at this stage).
Next, double click to open the admin folder (or what ever your admin folder is if you have renamed it).
Once in your admin, double click on the includes folder to open it.
Right click on configure.php and click 'View/Edit'. Again, if you wish you can drag this file to your computer to edit then re-upload.
IMPORTANT : The configure.php files are not the same file so make sure you keep them seperate if you do download them.
You should now see the admin/includes/configure.php open for editing and have the below.
<?php define('HTTP_SERVER', 'http://yourdomain.co.uk'); define('HTTP_CATALOG_SERVER', 'http://yourdomain.co.uk'); define('HTTPS_CATALOG_SERVER', 'http://yourdomain.co.uk'); define('ENABLE_SSL_CATALOG', 'false'); define('DIR_FS_DOCUMENT_ROOT', '/home/sites/yourdomain.co.uk/public_html/'); define('DIR_WS_ADMIN', '/admin/'); define('DIR_FS_ADMIN', '/home/sites/yourdomain.co.uk/public_html/admin/'); define('DIR_WS_CATALOG', '/'); define('DIR_FS_CATALOG', '/home/sites/yourdomain.co.uk/public_html/'); define('DIR_WS_IMAGES', 'images/'); define('DIR_WS_ICONS', DIR_WS_IMAGES . 'icons/'); define('DIR_WS_CATALOG_IMAGES', DIR_WS_CATALOG . 'images/'); define('DIR_WS_INCLUDES', 'includes/'); define('DIR_WS_BOXES', DIR_WS_INCLUDES . 'boxes/'); define('DIR_WS_FUNCTIONS', DIR_WS_INCLUDES . 'functions/'); define('DIR_WS_CLASSES', DIR_WS_INCLUDES . 'classes/'); define('DIR_WS_MODULES', DIR_WS_INCLUDES . 'modules/'); define('DIR_WS_LANGUAGES', DIR_WS_INCLUDES . 'languages/'); define('DIR_WS_CATALOG_LANGUAGES', DIR_WS_CATALOG . 'includes/languages/'); define('DIR_FS_CATALOG_LANGUAGES', DIR_FS_CATALOG . 'includes/languages/'); define('DIR_FS_CATALOG_IMAGES', DIR_FS_CATALOG . 'images/'); define('DIR_FS_CATALOG_MODULES', DIR_FS_CATALOG . 'includes/modules/'); define('DIR_FS_BACKUP', DIR_FS_ADMIN . 'backups/'); define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'download/'); define('DIR_FS_DOWNLOAD_PUBLIC', DIR_FS_CATALOG . 'pub/'); define('DB_SERVER', 'localhost'); define('DB_SERVER_USERNAME', 'OLD-DATABASE-USERNAME'); define('DB_SERVER_PASSWORD', 'OLD-DATABASE- PASSWORD'); define('DB_DATABASE', 'OLD-DATABASE-NAME'); define('USE_PCONNECT', 'false'); define('STORE_SESSIONS', 'mysql'); define('CFG_TIME_ZONE', 'Europe/London'); ?>
The lines you will need to edit are:
define('DIR_FS_DOCUMENT_ROOT', '/home/sites/yourdomain.co.uk/public_html/'); define('DIR_FS_ADMIN', '/home/sites/yourdomain.co.uk/public_html/admin/'); define('DIR_FS_CATALOG', '/home/sites/yourdomain.co.uk/public_html/'); define('DB_SERVER', 'localhost'); define('DB_SERVER_USERNAME', 'OLD-DATABASE-USERNAME'); define('DB_SERVER_PASSWORD', 'OLD-DATABASE- PASSWORD'); define('DB_DATABASE', 'OLD-DATABASE-NAME');
As you did before, you will need to update the DIR_FS_DOCUMENT_ROOT, DIR_FS_ADMIN and DIR_FS_CATALOG to use the correct full path. (squirrel hosting customers use /home/sites/yourdomain.co.uk/public_html/ or /home/sites/yourdomain.co.uk/public_html/admin/).
You will also need to update the DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD and DB_DATABASE like you did before to include your correct database details.
When you have made these changes, save the file and go back to FileZilla where as before it will prompt you to upload the file.
Step 7 : Update your OSCommerce file permissions.
Most servers (ours included) will upload your files with owner read and write permissions (644) and give folders owners read write and execute permissions (755) but on some servers you may need to change the permissions to 777 for certain files and folders. These folders and files are listed below with instructions on how to change permissions in FileZilla.
IMPORTANT : If possible try to refrain from using permission 777 as this can open potential security issues. If you are unsure what you need try 644 for files and 755 for folders first. It's always best to check this with your host.
- catalog/images to 777 (try 755 first)
- catalog/includes/configuration.php to 444 (try 400 first)
- catalog/admin/includes/configuration.php to 444 (try 400 first)
- catalog/admin/backups to 777 (try 755 first) and catalog/admin/images/graphs to 777 (try 755 first)
To alter a permission, navigate to the folder in FileZilla (as you did above to navigate to the admin/includes) then right click on the file or folder and click 'File permissions...' from the drop down.
In the popup box, enter the desired number in the Numeric Value box e.g. 400 then click the 'OK' button.
Step 8 : Update your domains nameservers
That's almost it! All that's left is to update your domain nameservers to use your new hosting (unless you did this in step 3).
If you are keeping your domain name with your current registrar then you will need to ask them to update the nameservers to your new hosting company's nameservers (Squirrel Hosting customers see http://squirrelhosting.co.uk/domain-names/nameservers.php)
Alternatively, you can transfer your domain name to the new hosting company you are using to keep your hosting and domain registration in one place (this usually updates the nameservers for you). To see guides on how to do this see 'Transfer .uk domain name' and 'Transfer .com domain name'.
Once your nameservers are updated, your website will be up and running!
Please share your experience
Did you find this guide useful? Did you have any issues with your transfer? Let us know in the comments below and we will update the guide to include this to help others transferring OSCommerce.
Leave a comment
Has this guide helped you? Have an idea for a guide or need help? Let us know below.