Currently I am playing with WordPress.org. Having a local environment for testing my functions are more convenient. Plus, it won’t break my blog if I am testing local rather than on the server.
I have Windows 7 Professional. And WordPress is developed by PHP with MySQL as database. So I need IIS+PHP+MySQL as testing environment.
I have no experience developing PHP. So after going through all the troubles, I think it worth to mark down what I did.
Following are the steps to develop WordPress on Windows locally:
0. Download necessary files
You need: php, MySql, Eclipse for PHP, WordPress
Php:
You can download installer of php in:
http://windows.php.net/download/
I recommend downloading the Thread Safe VC9 version if possible.
MySql:
Download the MSI Installer here:
http://www.mysql.com/downloads/mysql/
Eclipse for PHP:
You can choose other IDE if you like, but I love Eclipse because I am familor with it when developing Java. It is free and has lots of plugins. Easy to use.
http://www.eclipse.org/downloads/
WordPress:
I think if you are already hosting WordPress on a server, you should already have the wordpress zip file. If you are just testing WordPress, you can download it on their website:
http://wordpress.org/download/
1. Install IIS on windows if you have not.
If you have Windows 7 Professional, Enterprise, or Ultimate, you can install IIS 7.5. By default, IIS 7.5 is not installed on Windows? 7 Professional, Enterprise, or Windows? 7 Ultimate. You can install IIS by clicking Windows Features in Advanced Options under Programs in Control Panel.
You can refer to Microsoft’s website for detail:
http://technet.microsoft.com/en-us/library/cc725762.aspx
In Application Development Features, choose all except Server-Side Includes
2. Install PHP
Choose FastCGI for server. This is the fastest and most stable option on windows.
You can also refer to this document for detail. (Note: it is in Chinese)
3. Configure website folder to test if your PHP works
Start Menu -> Administrative Tools -> Internet Information Services (IIS) Manager
Here, you can see FastCGI setting under IIS section.
Click Sites -> Default Web Site -> Right Click -> Add Application
You will add an alias to your local folder here.
Physical Path is the path of your website folder. You can create a test folder and put a testing php file in it.
For example, you can put an index.php, with one line of content:
<?php phpinfo();?>
This will enable you to see your PHP server details.
If you give an Alias of yourside, you should be able to visit it by http://localhost/yourside
4. Create a database for wordpress
Run the MySQL msi file to install MySQL to any folder you like. You may want to set the char set as UTF-8 during installation if your blog is going to display international characters.
Run MySQL Command Line Client. Here you will create your database and user for your wordpress blog. Run the following commands:
CREATE DATABASE yourdatabasename;
CREATE USER ‘yourusername’@’localhost’ IDENTIFIED BY ‘yourpassword’;
GRANT ALL PRIVILEGES ON *.* TO ‘yourusername’@’localhost’
WITH GRANT OPTION;
5. Get your WordPress code in Eclipse
Unpack the Eclipse zip file.
Create a PHP project.
Import your WordPress files into the PHP Project.
Edit the wp-config.php (or edit wp-config-sample.php and rename it as wp-config.php) by providing database name, username and password.
Repeat the Configure website folder steps in section 3 to map an alias to your wordpress folder in eclipse.
If you make an alias of blog, you can install wordpress in:
http://localhost/blog/wp-admin/install.php
After simple configuation, you get your WordPress running. You still need to import your WordPress content by Export and Import function of WordPress.
Get to http://yoursite.net/wp-admin/export.php Click Download Export File.
Then get to your local and import the file.
Now you will find that you can also run your php files of WordPress in Eclipse simply by Right click the file -> Run As -> PHP Web Page
Join developing your blog. 🙂