There are loads of guides online for doing this but only for Apache web servers. It describes it in all manors for every other system other than IIS and MySQL. Here’s a step by step guide to achieving this.
Magento 1.9.x.x running on IIS 8.5 with MySQL.
To export the Website and copy it to another IIS server with MySQL (either to make it Live to take a copy of the live website for testing).
How to do it
1. In IIS select your Magento website and Export the application to a ZIP file.
2. You will need to export the database from MySQL. To do this if you have not already, install MySQL Workbench. From here you can export your Magento database into a .sql file.
In MySQL Workbench login to your instance, then click Server > Data Export. For me, I exported to a singe .sql file.
3. Now you have a full backup of your website, on the target server you need to ensure the pre-requisites for Magento are installed. The easiest way to do this is to use the Web Platform Installer. Just use it to set up a Magento store, then remove that store from IIS once set up. This will install all the PHP, CGI and all the modules that Magento requires . You will also want to install MySQL Workbench to import the database later. You can also remove the database that was just created when installing Magento to keep your instance clean.
4. Now we have a server that has all the pre-requisites we can copy the .sql file and the .zip file we exported earlier to the new server.
5. Open MySQL Workbench and Import the database. The password for your instance on this server will be whatever you set it up with when you installed Magento in the previous steps. When you name the database, name it the same as the source database. You will need to create a user in your new instance to match that of the source database. If you don’t know the old details this is where you can find them:
6. Once imported open the “core_ config_ data” table and fine the web/unsecure/base_url and web/secure/base_url rows.
These need to be changed to whatever DNS name you will give the site on the new server (including the http:// part). If they are not changed when trying to access the website you’ll be re-directed back to whatever the current value of these fields are.
7.Now that database is ready, go to IIS, create a new Site and configure the basics.
b. Root Directory
c. Credentials to the root directory (and test them).
d. Finally, Import the ZIP file we exported earlier.
8. Next we need to modify the application to point to the new database instance and use the correct username and password for the database using the information collected in step 5.
In the new IIS Magento folder structure open /App/etc/Local.xml and /App/etc/config.xml.
9. Before you can access the website you’ll need to delete everything in /Var/Cache/
10. Set up any required DNS records to point to the new site.
11. You should now be able to visit the new site. If you have issues with Magento errors, try this:
- Navigate to the “errors” folder.
- Change local.xml.sample to local.xml
- You should now see a new list of crazy errors all over the Magento page – this is okay.
- Open magento/lib/Zend/Cache/Backend/File.php and look for:protected $_options = array(
‘cache_dir’ => ‘null’,
- Change it to:protected $_options = array(
‘cache_dir’ => ‘tmp/’,
- Save it.
- Now the final step is to go create a tmp folder in the root Magento folder.
- That’s it.
12. Finally – When I did this I got some 500 erros when first trying to access the page. This was because the web.config file from my export contained Modules that were not installed on the target server. To resolve this I simply removed the <Modules> section from the target servers site lever web.config file.
I hope this is useful to someone.