Almost all good developers that I know have some kind of repository of their code. Mine is my blog, this blog. Stay with me and you’ll find out how to easily be able to create your local version of WordPress, customize and test your plugins.
For´this you’ll need to follow the next steps:
- Go to Webmatrix official website and download the Web Platform Installer which will install for you not only Webmatrix itself, but also a lot of useful tools like an integrated webserver, Internet Information Services Express, PHP interpretor and its connectors just to name a few. But you can also use it to add new features like ASP .Net MVC3!
- Because now the install of MySQL server is not any more supported, you’ll have to install it by yourself – go to their official website and download it from there. Choose the MSI Installer essentials and the process will be very easy. I prefer to install it as a service and then, from Control Panel –> Services, to set it to start manually. This way won’t eat resources when it is not needed.
- Next, we’ll download a MySQL GUI called HeidiSQL – free and smart product. One might say that command line is enough, but I would rather concentrate on development instead of memorizing all those commands.
- Create an empty database and a user. I personally like to set the database name, user and its password to the ones that I use on my production WordPress website. This way, I only have to modify only the DBHost in the WordPress’ configuration file.
- Create a production database backup using your prefered tool – I use for quite a while the WP-DB-Backup plugin for WordPress to generate my scheduled backups. Import the content of the backup (using HeidiSQL is very easy – just point it to a zip, gzip archive or a sql file).
- Now that we setup our database, let’s go to the code – download locally the sources of your website using FTP or other tools that your hosting provides, open Webmatrix and create a new website using local files. This way you will setup your development workspace wherever you like – I prefer to use D: drive. Otherwise, you’ll be prompted to use your MyDocuments folder which will not be available any more in case of windows clean reinstall – the entire c: drive will be wiped-out.
- Make the proper changes to the wp-config file (if you followed my advice you’ll just have to replace in DBHost your production server with localhost). Hit Run (the small green arrow from the Webmatrix top ribbon) and you’re good to go!
If by any change you get a blank window in your prefered browser stating that “
Error establishing a database connection
” or something like this, go and check that in your hosts file (found in c:\Windows\System32\drivers\etc\) you have uncommented the line with localhost:
# For example:
# 188.8.131.52 rhino.acme.com # source server
# 184.108.40.206 x.acme.com # x client host
# localhost name resolution is handled within DNS itself.
# ::1 localhost