Deploy WordPress to Windows 2008R2 – Part III

Part 3 – Fine tun then install a fresh WordPress for testing

We need two IIS Extensions for proper working of IIS 7.5 with WordPress, they are URL Rewrite and Wincache extension for PHP.

  • URL Rewrite
    This extension is important if you want to have Pretty Permalinks (and who does not?) in WordPress. If you don’t know what I am writing about, read here about Permalinks in WordPress (or directly from WordPress).
    Point your web browser to, and by the end of that web page, select one of the x64 variants, according to your language. For English, I downloaded rewrite_2.0_rtw_x64.msi.
    Install URL Rewrite 2.0, then follow the instructions on the above referenced links to set the web.config manually and you will be done. Note: WordPress 2.8 and later will update web.config for you if you grant write permission to web.config file (but grant temporarily only!).
  • Wincache
    To download Wincache, point your web browser to Don’t be scared by the apparent abandon of the page, it comes as no surprise that Microsoft does not care much about PHP since this competes directly with their own .Net product. Anyway, around the bottom of the mentioned page you will find a link to WinCache 1.3 for PHP 5.4 – x86. Wow, this URL takes us to Sourceforge, so Wincache is not really a Microsoft product. 😳
    To install Wincache, run it to unzip the content to a folder then copy php_wincache.dllto the PHP extensions folder (C:\inetpub\php\ext). Edit php.ini and change or add the following:

    • In the dynamic extension section add:
    • Search for the line session.save_handler = files and  replace it with the line session.save_handler = wincache
    • Make a folder under the PHP tree, call it phpsessions, give Users and IIS_IUSRS permissions to read, write, modify and delete on that folder. Add the following line to php.ini:
      session.save_path = “C:\inetpub\php\phpsessions”
    • Restart IIS then launch phpinfo.php again (see Part II) to confirm that Wincache is inserted in the system

We are done with the tuning, time to go to the WordPress website and download the latest WordPress distribution, which was 3.4.2.

Important: Here, installing WordPress is only for illustration purposes because, as you will see in the final Part IV of this tutorial, we don’t need WordPress previously installed when publishing  to a web server a website already developed  in our home or office computer.

So, place the WordPress distribution in a suitable place within the inetpub folder, such as inside wwwroot, then unzip it. The whole WordPress will be unzipped to a subfolder of wwwroot, very appropriately called wordpress. If what you wanted was build a new website exclusively based on WordPress you could have placed the WordPress distribution directly inside the inetpub folder (or anywhere), unzip, rename the obtained wordpress folder then set that folder as a website from within IIS.

Before we can run WordPress, we need to do a few things.

  1. In IIS Manager, select the Default Web Site. Double-click Default Document, select Add from the right pane and add index.php to the default documents list.  Move index.php to the top of the list.
  2. To set up a mySQL database, download phpMyAdmin. The release I got was Extract the distribution to C:\inetpub\wwwroot\phpmyadmin. Navigate to http://localhost/phpmyadmin, type root for user name and the password should be the same used when you set up the mySQL software (Part II of this tutorial). Then Create a New Database, giving it an appropriate name (like “wordpress”). Collation should be set to utf8_general_ci.
  3. In the wordpress folder, rename wp-config-sample.php to wp-config.php. Edit wp-config.php with Notepad (or similar). If necessary, change the line define(‘DB_NAME’, ‘wordpress’) replacing wordpress with the name of the database chosen in step 2 above. Change the lines define(‘DB_USER’, ‘wpuser’) and define(‘DB_PASSWORD’, ‘yourpasswordhere’), using the user name and password for the mySQL database. All this procedure has been utterly simplified, but we are now ready to launch the WordPress test website.
  4. Point your browser to http://localhost/wordpress and you should see the WordPress installation welcome page.
(to be continued soon)

Deploy WordPress to Windows 2008R2 – Part II

Part 2 – Install MySQL and PHP

Download the latest and greatest MySQL Community Server software from the MySQL Community Server Downloads  page (at the time of this writting it was release 5.5.27. I downloaded the 64-bit edition, i.e. mysql-5.5.27-winx64.msi). Install MySQL following the easy steps explained in this interesting blog entry. You can tweak a bit, but you will be perfectly good if you just use the same settings.

With MySQL installed, it is time to install PHP. Although our server is 64-bit, I am going to install a 32-bit edition of PHP, not a 64-bit edition. It is true, there are unofficial 64-bit releases of PHP, they are good but don’t have the latest PECLs (PHP extensions) and you will need them (particularly the WinCache PECL). Since PHP is going to run out-of-process, either 32-bit or 64-bit does not matter. So, point your web browser to the official PHP web site and select the latest PHP stable release (at the time of this writing it was release 5.4.6). Select the “Non-Thread Safe” variation (most suitable for IIS) and download it (the file was Unzip and extract the content to C:\inetpub\php (can be another folder). The situation now looks like the following image.

PHP Folder

Before doing anything else and become frustrated because it does not work and the cryptic error messages do not help track the origin of the problem you need to install the Microsoft Visual C++ 2008 Redistributable Package (because PHP was compiled with it). Download it from Microsoft and install.

Now launch Internet Information Server Manager to add a Module Mapping of PHP to FastCGI. Follow the procedure from this blog (nice blog, already mentioned above).

Add Module Mapping

Time to confirm if PHP is working. With Notepad, make a text file called phpinfo.php with just one line of text:

<?php phpinfo(); ?>

Place phpinfo.php in c:\inetpub\wwwroot, launch your web browser and point it to:


If all went well, you will see something like this image:

PHP Info

Continue reading the blog mentioned above and launch the Registry Editor (Regedit.exe) to add the key PHP to HKEY_LOCAL_MACHINE\SOFTWARE. Create a string value called IniFilePath for that key and set it to: c:\inetpub\php.

In your PHP folder, search for php.ini-production and rename it to php.ini.

Edit php.ini with Notepad, or another fine plain text editor, search for extension_dir = “ext”‘ and uncomment it by removing the semicolon.

Uncomment the following extensions:
extension=php_exif.dll ; Must be after mbstring as it depends on it
Note: You may not need all these extensions (and you may need others too), but let it stay like this for now.

Still in php.ini uncomment then set where required:
fastcgi.impersonate = 1
cgi.force_redirect = 0

Make a folder named phpTempDir, under the PHP install folder, give read, write, modify permissions to the IIS_IUSRS account then set php.ini like this:
upload_tmp_dir = “C:\inetpub\php\phpTempDir”

 (continues in part III…)

35% OFF Total coupons 50

Just for testing the popularity, I am offering the coupon OSPV35OFF for any purchases in the site

There is a redemption limit of 50, i.e, when this limit is reached the coupon ceases to be accepted.



Date: 7th Sept 10PM : Only 43 available.

Date 8th Sept 8PM:  Only 41 available.

Date 9th Sept 7PM: Only 40 available.

Date 10th Sept 8PM: Only 32 available.

Date 11th Sept 11PM: Only 17 available

Date 14th Sept : This offer is not valid anymore.

Deploy WordPress to Windows 2008R2 – Part I

Part 1 – Preparing the Windows 2008R2 Server

This is the first of a total of four posts about deploying Wordpress to a Windows 2008R2 remote server.

The matter is not straightforward for a few reasons:

  1. It is not easy to troubleshoot WordPress issues on Windows. Most WordPress gurus are of no help here because they have no experience using WordPress within Windows, as simple as that.
  2. Dealing with Windows 2008R2 deserves a long article of its own, as you may suspect.
  3. Tools from Microsoft, like Webmatrix and Webdeploy do not contribute at all to your knowledge. What I mean is that you follow the instructions, if something goes wrong you have no alternative but search forums and blogs, in other words use Google. So, you should resist with all your strengths in embarking into the easy road of doing things with click-once tools. That said, beware that for this series of posts I used WebMatrix in my Windows 7 development box, it was not a true time saver for me, but I followed the route most WordPress for Windows developers use, in order to make the situation more real.

So, imagine you have WebMatrix installed in your Windows 7 home or office computer, and developed a great WordPress website with it.  Now, the time has arrived to publish that amazing site to your web server lodged in a Windows Server 2008R2 (dedicated, VPS or cloud) located somewhere in the World. You can use FTP, right? Unfortunately, FTP solves only part of the problem because WordPress sites store the real content and most of the configuration in a mySQL database. Without the mySQL database your site is just a bunch of templates, or so it looks. So, you must FTP the database as well, right? Unfortunately not. Here Microsoft proposes the use of Web Deploy, but I was never able to use it properly. Web Deploy has many caveats with WordPress, one of them is that it can’t fix URLs except in the simplest of cases. Let’s move on without Web Deploy!

As a side note,  for people wondering why we are writing about dedicated, VPS or cloud servers instead of shared web hosts. Nowadays, lots of people have their own virtual servers because prices are low, and less and less people use slow shared web hosting for professional and corporate purposes. For instance, Amazon offers you, totally free during one year, a full fledged Windows Server 2008R2 (64-bit, of course) including a fair amount of bandwidth. Do you believe on this? Better you do, I will be using one for this article. Look at the image below:

So, you got a fresh installation of Windows 2008R2, like the one I got after I subscribed for my free micro EC2 at Amazon, then you had to go through the initial configuration steps, like Date and Time Settings, Keyboard selection, change the Computer name (not compulsory but recommended), and a few others. One thing I always do on new machines is configure the folder options in Windows Explorer, because I enjoy look at things as they are. Under the Organize menu of Windows Explorer, select Folder and search Options, then in the View tab, check “Show hidden file, folders and drives”, uncheck “Hide empty drives in the Computer folder”, uncheck “Hide extensions for know file type” and uncheck “Hide protected operating system files (Recommended)”. All right, I would never feel good until I completed this step.

But there is more!

  1. Now, launch Server Manager and add the role for Web Server. You may well select every Web Server service role or leave aside the ones you are sure you will never need, like let me say IIS 6 Management Compatibility, IIS Hostable Web Core,  Clienet Certificate Mapping Authentication. Make sure you do not forget to add the CGI role, this is very important to our purpose.
  2. Now install Filezilla (last version at the time of this writing was 0.9.41). Of course, you can install another FTP server, but Fillezilla is probably the best and the price could not be better. If you are indeed using the free Amazon EC2 box I mentioned above you will spend some time learning how to open ports through the perimeter firewall. It is not very easy easy, and by default only the RDP port is open. Anyway, this is home work. As a hint, consider opening the following TCP ports through the perimeter firewall: 21, 25, 80, 110, 1433, 3389 (RDP, already done) . If you want to have a DNS server there consider opening UDP port 53. If you want to be able to ping the server consider allowing Echo Request ICMP packets to pass through. Note: Amazon EC2 boxes are quite good and fast, but for a production server you will need more than what is supplied with the free tiny box and then costs climb pretty fast because you pay for everything. My cost estimate for a production web server installed on the small model (above tiny) will be around $80.00 per month in Amazon. For this reason I keep all my production servers with Burst, I pay less than $24, have 2.5 GB RAM, 2.5 GB memory and 100 GB hard disk.  But remote desktop to Burst is not as fast as to Amazon EC2 and server takes longer to boot, these are the real differences between cloud and VPS.
  3. Now launch the Windows Firewall Control Panel, enter an exception for Filezilla Server, add new Allow rule (Public/Domain/Private) for port 21 TCP. This should be enough, in most cases, to allow you to connect to Fillezilla Server from the Internet in “Active Mode” (I usually prefer this mode). For more about Active versus Passive FTP check this URL: While we are configuring the Windows Firewall, add a Ping Echo Request rule, otherwise server can not be pinged from the internet.
  4. At this point you may want to disable the Enhanced Security from Internet Explorer (or alternatively, look for another internet browser). Disabling enhanced security is done as explained here:

This completes the preparation of our Windows 2008R2 Server.

(continues in Part 2…)

Extended Memory Tutorial in Portuguese

Last year, I posted an old x86 Assembly Language Tutorial in Portuguese. I know it is very old but I also know that many schools start from there. So it comes as no surprise to notice that everyday people bothers to download the big .pdf files and the 16-bit ASM samples.

Within the same line I decided to post now the Extended Memory Tutorial (in Portuguese too), originally published in the same defunct Spooler Magazine in 1993 :). Click Here!

Linking Assembly Language with Delphi Part II

On the 16th October, I posted about linking 32-bit Assembly Language to Delphi and on 29th September I had presented a simple example of linking 64-bit ASM to Delphi. For today, I have ported  the 32-bit ASM to 64-bit to link it to Delphi XE2. Also, today we are going to link a 32-bit COFF file with Delphi XE2, this appears a waste of time but is not. Click HERE!

Linking Assembly Language with Delphi Part I

Linking Assembly Language with 32-bit Delphi Compilers (let’s do it for Delphi 5, some people still use it. But the same procedure applies to all releases, although with XE2 you have another alternative). Click HERE

Assembly Language Tutorial in Portuguese

I had this Assembly Language Tutorial in Portuguese, it is very dated but last time I posted it in the internet some people enjoyed. Click HERE

Mixing .Net and Assembly Language in a standalone 32-bit exe

Building a standalone .Net .exe file containing native code is possible with the “It Just Works” facility, but when you want to mix C# and Assembly language some more work is involved. We show the way to do it in 32-bit (We have done it for 64-bit a few days ago). Click HERE.


A while ago I ported some x86 ASM to x64, just to practice 64-bit ASM programming. Not only because the program itself is fun but mostly because it may help others learning 64-bit ASM I decided to leave it here. Credits of the original are mentioned. Click here