Technical Recipes

Set up WordPress environment on Windows

1 Set up Apache web server

    1.1 Set up static IP for the local PC
    
    1.2 Download and install Apache Web server 2.2 as a Windows Service
        - Win32 Binary including OpenSSL 0.9.8y (MSI Installer) from http://httpd.apache.org/download.cgi
        - Select set up type: Typical
        - Choose the default destination folder: 
        C:\Program Files (x86)\Apache Software Foundation\Apache2.2\
        
    1.3 Start the httpd service and make it automatically start
    
    1.4 Verify from the browser http://localhost is available

2 Install PHP with Apache

    2.1 Download PHP 5.5 package for Windows
        - Download VC9 x86 Thread Safe for Apache 2.2 from http://windows.php.net/download/#php-5.5: php-5.4.21-Win32-VC9-x86.zip
        
    2.2 Install according to the documentation at http://us3.php.net/manual/en/install.windows.manual.php
        - Extract the zip to c:\php_5.5
        - Download Visual C++ Redistributable for Visual Studio 2012 Update 3 from http://www.microsoft.com/en-us/download/details.aspx?id=30679: vcredist_x86.exe''
        
    2.3 Copy the php.ini-production into php.ini in the same folder
    
    2.4 Change the php.ini file
        extension_dir = c:/php_5.5/ext
    	extension=php_mysql.dll
    	log_errors = On
    	error_log = c:/php_5.5/php_errors.log
    
    2.5 Install as an Apache handler refer to http://us3.php.net/manual/en/install.windows.apache2.php
        - Insert the following lines into your Apache httpd.conf configuration file to load the PHP module for Apache 2.2 as Administrator
    	LoadModule php5_module "c:/php_5.5/php5apache2_2.dll"
    	AddHandler application/x-httpd-php .php
    	# configure the path to php.ini
    	PHPIniDir "C:/php_5.5"
     
       - If use Apache 2.4, change to 
         LoadModule php5_module "c:/php_5.5/php5apache2_4.dll" 
       - Add the DirectoryIndex index.php directive in httpd.conf file to load index.php by default
       - Restart Apache server

3 Set up MySQL server

    3.1 Download and install MySQL 5.5 as a Windows Service
        - Download from http://dev.mysql.com/downloads/mysql/
           Windows (x86, 64-bit), MSI Installer: mysql-5.5.27-winx64.msi 
           Windows (x86, 32-bit), MSI Installer: mysql-5.5.27-win32.msi
    3.2 Start/stop the mysql service from Windows Service or
           > NET START mysql
          > NET STOP mysql 
    3.3 Verify from the MySQL client console
           > mysql -u root -p --port 3300 
    3.4 Create MySQL user and database for WordPress
     > mysql -u root -p --port 3300
    > create database blog
    > grant all privileges on blog.* to ''@'' identified by ""
    > flush privileges;
    > exit
     
    3.5 Reset password for MySQL
	 > set password for ''@'' = OLD_PASSWORD('password'); 

4 Download and install the WordPress package

    4.1 Download from http://wordpress.org/download/: wordpress-3.7.zip 
    
    4.2 Unzip it under the folder: 
     C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs 
    
    4.3 Configure wp-config.php
        - Copy wp-config-sample.php to wp-config.php under
        C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\wordpress
        - Edit wp-config.php as Administrator
		define('DB_NAME', 'blog');
      define('DB_USER', '');
      define('DB_PASSWORD', '');
      define('DB_HOST', 'localhost');
      define('DB_CHARSET', 'utf8');
      define('DB_COLLATE', '');

        - Use the online generator to generate security keys and copy them into wp-config.php according to 
http://codex.wordpress.org/Editing_wp-config.php, save the wp-config.php

    4.4 Restart Apache service
    
    4.5 Run the install script in browser http://localhost/blog/wp-admin/install.php

5 Re-install WordPress

    To reinstall, make sure you clear your old database tables first.