I just got done speaking at Wordcamp Norway (#wcnorge) on the topic of running WordPress on Windows. The talk seemed to be well received despite the powers that be on the demo side not being kind to me. My first install of WordPress had an port conflict with a previous version and failed. ARG! Regardless, […]

I just got done speaking at Wordcamp Norway (#wcnorge) on the topic of running WordPress on Windows. The talk seemed to be well received despite the powers that be on the demo side not being kind to me. My first install of WordPress had an port conflict with a previous version and failed. ARG!

Regardless, it’s been a while since I spoke at a Wordcamp but I always have a lot of fun doing so. The talk was well received, especially some of the stuff that’s not in the slides such as the web testing in Visual Studio 2010. It allows you to record a browsing session and then turn it into a load test very quickly.

The deck is a compilation (greatest hits really) of some of my previous talks. I didn’t drain all the slides but rather they are here for reference for folks.

It was also cool that Zé Fontainhas from Automattic was in the audience and liked the talk. Actually, we had a couple of people in the audience who were already running WordPress on Windows who provided unprompted testimonials. It was fun.

Thanks for the hospitality of the folks in Norway – next time I have to come back in the summer!!!

I just finished doing a talk at OpenCa.mp in Dallas called “Scaling WordPress (and really any PHP application) on Microsoft. The reality is that there is a tremendous amount of support for WordPress on the Microsoft stack including Windows, IIS, SQL Server, Azure and more. OpenCa.mp was a an interesting conference and interesting crowd for […]

I just finished doing a talk at OpenCa.mp in Dallas called “Scaling WordPress (and really any PHP application) on Microsoft. The reality is that there is a tremendous amount of support for WordPress on the Microsoft stack including Windows, IIS, SQL Server, Azure and more.

OpenCa.mp was a an interesting conference and interesting crowd for my session. The idea behind OpenCa.mp is to get all of the big CMS options under the same roof and cross pollinate. This included WordPress, Joomla! and Drupal from the PHP side of the house, DotNetNuke and SiteFinity from the .NET side of the house and Polux from the Python side of the house. It was an interesting mix. I was a little nervous that it would just be a giant argument. While some of that did happen, I actually had a few people from Drupal and Joomla! in my WordPress session and people were fairly civil the whole weekend.

Getting to the session

Now, on to my session itself. This was a fun session. I only had 30 minutes and I had about 3 hours of material so I’ve got a ton of stuff in these notes that I didn’t cover in the session itself.

The session is a take off a session that I did at MODxpo back in the spring. The talk itself is about 3-5 minutes of slides and the rest is all demos. Really, there’s not time to do all of the demos that I’d like to do. I could spend 3-5 hours doing demos if they’d let me. I’d love to get up and sling a lot more code than I normally get to in a conference session and really dig deep on the tech side.

The most important slide in the deck is my contact slide which has my email address and such on it so that people can reach out to me with any questions.

I love getting follow up questions after a session because it proves to me that people were listening and not just hiding from the Texas heat in my room.

Microsoft is a software company that builds a lot of great platforms and applications. We have a large number of finished applications such as Microsoft Word and so on that a ton of people use out of the box every day to accomplish their job. But one of the exciting parts about Microsoft is that almost everything starting with Windows, SQL Server and so on all the way up to Microsoft Office is also a platform that other people (read you in the audience) can write applications on top of in addition to just using out of the box. The conglomeration of platforms from Microsoft that I’m talking about today is Windows, IIS, SQL Server and Azure and running PHP/WordPress on top of those platforms.

Looking Back

Before we get to that, however, we need to take a quick peek back in history. Many of you probably tried PHP on Windows at some point in the history so you’re thinking that I’m crazy to attempt PHP on Windows. The reality is that in the past you might have been right.

5 years ago, PHP did not run on Windows all that well. It was slow. PHP wasn’t optimized for Windows/IIS and Windows/IIS wasn’t optimized for PHP. Painfully slow at points.

It wasn’t compatible with the other versions of PHP. If you were on Windows vs. Linux, you had to take that into account when you were writing your applications and there were standard switch blocks that you’d have to code in order to accommodate the different platforms. Most people didn’t bother doing that so there was platform lock in which defeats much of the purpose of running PHP.

There wasn’t a good implementation of mod_rewrite or a good alternative. This cause all kinds of problems with SEO optimization and much more.

There were many other problems and it just made the PHP developers (understandably) mad at Windows and Microsoft.

So where are we now?

Microsoft has invested a tremendous amount of time and resources into making sure that we fix all of those issues.

PHP on Windows is fast. FastCGI support for IIS 7.0, 6.0, 5.11 rocks and is fast. It’s the default on IIS7 and it’s a fast and reliable way to run PHP on Windows. Additionally, there’s a fantastic opcode and object cache library called WinCache that is distributed with PECL. More on this in the demos.

There are all kinds of benchmarks out there but I’d like for you to test it yourself. There are many areas where PHP on Windows/IIS is just as fast or faster than PHP on Linux/Apache. There are other areas where performance suffers some. You should test your application on both platforms and compare performance. For some applications you’ll be pleased, for others you won’t be. Either way you’ll learn something about your application.

PHP on Windows/IIS is compatible because it’s the same PHP. This means that most of the applications should just run on IIS. Where there are incompatibilities, it’s because there are some extensions and such to PHP that don’t run on IIS because they are deeply embedded in the Apache piping system or they leverage something in Linux and so on. In some cases there are compatible alternatives. In other cases, we’ll have to work around those. If you run into one of these cases – PLEASE reach out to me and let me know what you’re trying to accomplish.

A great example of where we don’t have the exact same thing but a great alternative is mod_rewrite on Linux and URL Rewrite on IIS. I’ll walk through a demo of this in just a little bit but in short, URL Rewrite is a fantastic and powerful engine that allows you to do some outstanding things.

More pigs fly – we didn’t stop there. In June 2009, we contributed 20k lines of source code to the Linux kernel to do much better virtualization support for things such as Suspend, Hibernate and Resume. Obviously our motivation was to get it to work better with Hyper-V but that code also helps with VMWare, Parallels and more.

Getting to the Demo

Now, all of that is fantastic but let’s get to some demos. Demos are the meat of this talk.

‘Cause I think that you want to see what’s in my smokin toolbox here and seeing is believing.

Web Platform Installer

The first thing I need to do is get WordPress up and running on my Windows installation. The easiest way to do that is with the Web Platform Installer. This is a free tool that Microsoft has put out there to make your life easier on IIS. You can, under the Web Platform Tab, configure your server to install modules such as URL Rewrite, Advanced Logging features, ODBC or any number of things that are optional on IIS but you might need to leverage.

But the tab that we’re most interested in is the Web Application tab where you can find WordPress. Under this tab you’ll find a bunch of different applications ranging from Aquia Drupal to DotNetNuke to Moodle to ScrewTurn Wiki to WordPress.

If you select WordPress and click Install, you’ll get the installation wizard which will analyze the requirements for the applications and make sure that you have everything and download it if you don’t. An important thing to notice here is that the WordPress install is actually coming from http://wordpress.org/wordpress-2.9.2-IIS.zip. If you’ll notice, that’s actually coming from the WordPress foundation rather than from Microsoft. We’re not distributing WordPress or any of these projects. Instead, we are providing a channel and portal for those applications with a lot of support to make sure things are tested and ready to go.

The next couple of screens that we see are configuring your specific installation. The first screen is a common screen that all of the projects get that has to do with were you’re going to put the physical files and the virtual directories stuff that IIS cares about. If you are running multiple web sites off of one machine, here’s where you make that assignment. For example, I’m running http://www.joshholmes.com and http://www.wonderpuzzle.com off of the same server

The second page is actually configured by the project itself and has to do with the project’s configuration files directly. WordPress, for example, needs to know the MySQL Administrator’s password so that it can log into MySQL and create the database. It also needs to create a user for that database it set it’s password and the like. This is all part of the package that was downloaded from WordPress.org.

Investigating the WebPI Package

That package is just a ZIP file with the PHP files, SQL Scripts and a couple of XML files in it. If you open the ZIP file and look at the parameters.xml file, you’ll see how this is all built up. For example, there’s a custom parameter called DbName with a default value of “wordpress” that’s got a regular expression validation of “^\w{1,16}$” or in English, 1 to 16 characters in length with no whitespace or punctuation. This parameter file is inserted into the install.sql file wherever the Web Platform Installer finds the word “PlaceholderForDbName” and in the wp-config.php file where if finds “putyourdbnamehere”. This makes it easy to set up any parameters that you want and insert them into any file that you want. And if you want, you can create your own projects and custom feeds for the Web Platform Installer to leverage. I’ll have to write an article about doing that in the near future.

The next thing that happens is that the install is done and you’re ready to start setting up your WordPress install. You should be, if you’ve ever set up WordPress on any platform, be familiar. You have to make sure that you copy that fantastic auto-generated password, log in and immediately change your password so that you don’t forget it.

An important thing to point out here is that even though it’s an older version of WordPress that’s installed, it’s still WordPress and WordPress can update itself and you should do that if you are going to run this for more than a quick demo.

Pretty URLS and URL Redirect

The next thing that I want to do is set up my navigation and URL redirection. Just like any other WordPress install, you can do that under Settings | Permalinks. Select your favorite configuration and once you save your updates, there’s a prompt that tells you “You should update your web.config now”. If you’ve done this on Linux, you’ll get a prompt that says “You should update your ht.access now”. This is because URL Rewrite leverages the web.config. You can actually, if you’ve got an ht.access file that you use all the time, import that directly through the Internet Information Services Manager. The web.config is an XML file that has a tremendous amount of power. In this file you’re able to create file handler mappings, security settings on a per directory level, FastCGI settings, default documents for the application, IIS modules and a ton more. The web.config that WordPress requires at a minimum for pretty URLs is as follows:

Save this as a file called web.config in the root directory of your web application and you’re good to go with pretty URLs.

Quick Peek At WinCache

The next thing that I want to look at is WinCache. WinCache is a library written by Microsoft and distributed through the PECL Foundation. It’s a op code caching and object caching library that is on by default in the PHP install from the Web Platform Installer. To demo this I turned off WinCache in the php.ini file and used a little client app called WyCats that spins up 25 threads and starts hammering the server. It measures the number of requests, responses, errors and the like. Then I turn WinCache back on and restart WyCats. Immediately there’s a 3-4x improvement in performance. We could go a lot deeper with WinCache but that’s a topic for a different blog post.

Windows Azure Data Storage

This helps you scale vertically on a single box but to get true scale, we’re going to need to start leveraging horizontal scaling. One of the easy things to do is leverage a WordPress Plugin called “Windows Azure Storage for WordPress” which will offload the use generated media such as pictures, media files and anything else heavy to the Azure Data Storage which can be put out on the new Azure Content Delivery Network. That’s got a global footprint and helps you put your content near to your reader.

More WordPress Plugins that Rock

There are a lot of other WordPress plugins that leverage various parts of the Microsoft ecosystem including the Bing 404 plugin, the Bing Maps plugin, the Silverlight Streaming Media plugin and more. I’m pretty excited about all of these plugins.

The Bing 404 plugin handles broken links and will do a Bing search of your site suggesting possible updated links. This one was written by Cal Evans of Blue Parabola.

There are actually three different Bing Maps plugins. The Silverlight Bing Maps plugin is awesome, even if all of the comments are written in French. It helps you drop a Bing Map anywhere on your site with the use of shortcodes.

The Silverlight Streaming Media leverages the Smooth Streaming support in IIS to intelligently stream the media at the appropriate fidelity for your consumer based on their bandwidth, machine specs and the like.

All of these plugins are obviously released under GPL since they are hosted on the WordPress.org site and easily found through the add new plugin search.

Windows Live Writer

One of the things that I didn’t plan on hitting on but decided to after I saw that there was a fair number of bloggers in the room that weren’t as technical is Windows Live Writer. It’s a free tool that allows you to do your blogging and posts in a desktop application so you can do it offline and have all of the richness of a desktop application. It’s got preview states where it will actually show your blog post as you’re writing it as it will look on the page complete with margins, your CSS and the whole nine yards. There are hundreds of fantastic plugins to do everything from inserting maps to formatting HTML code to managing flickr images.

It’s the tool that I use to do all of my blogging. This post, as an example, I wrote in three different airports, on two different planes and I’m in my hotel room at the moment finishing it up.

SQL Server Support!

Another thing that’s very exciting is SQL Server support is available right now. This is not in core yet but we’re hoping that we can get it accepted at some point in the near future.

Not only that, but there’s a new PDO driver for SQL Server so that any code that leverages PDO (such as Drupal) can have SQL Server support if you’re using SQL statements that are supported by SQL Server. For example, if you’re using LIMIT statements as an integral part of your business logic, we’ll need to figure out a workaround.

Free Stuff

Now, if any of this interests you we’ve got a number of different offers to that fit a variety of options for getting you software, marketing support and more from Microsoft.

Before we even talk about the *Spark solutions, there are a ton of tools and applications that are free from Microsoft.

Web Platform Installer – I already talked about this a ton.

Visual Web Developer Express – This is a fantastic web dev toolkit that includes code editing, debugging support and more.

SQL Server Express 2008 – This is actually a really powerful option as a free database option. It supports up to a 10 gig database, transactions and the whole nine yards. The features that it doesn’t include are in the enterprise features such as Reporting Services and the like.

Windows Azure SDK for PHP – This fantastic SDK gives you access right in PHP to all of the Windows Azure Data Storage options and much more.

The list is actually REALLY long but this isn’t the focus of this blog post and I didn’t really spend a ton of time on it in my talk cause I didn’t have time.

DreamSpark is for Students. This gives you access to many of our professional tools and the like for you to leverage. There are also fantastic student discounts on Microsoft software for students. DreamSpark is completely free of charge.

WebsiteSpark is for small shop web consultants. The definition of that is anyone whose company is less than 10 people (yes – individual consultants count in this definition) and the company creates net new web sites for other people and companies. What this gives you is 3 copies of Visual Studio Pro and Expression Web, a copy of Expression Blend, production licenses for Windows Server and SQL Server Web Edition, entry into the Microsoft Pinpoint tools which drives business to local Microsoft partners and more. There are no upfront costs and at the end of three years, Microsoft will invoice you for $100.00. Other than that, it’s free of charge.

BizSpark is for technology startups. The definition of a technology startup for the purposes of this program is less than 3 years old, less than one million in revenue a year, privately held and creating software or software as a service. This gives the startup 25 licenses for MSDN which gives the developers pretty much any thing that they can build an application on top of. There’s also marketing support and such that can be leveraged through this program. There are no upfront costs and at the end of three years, Microsoft will invoice you for $100.00. Other than that, it’s free of charge.

I strongly encourage you to look at the various spark programs and see if there’s one that fits you.

More Azure Support

Don’t know if you know this but OddlySpecific.com, which is running in Azure itself and leveraging the SQL Server support and the Azure Data Storage options with SQL Server. We’re working making that more broadly available so that sometime soon you could run in Azure as well. The awesome part about that is that it will allow you to scale up very quickly to meet market demands without having to think about infrastructure.

Conclusion

To wrap up the talk and this blog post, PHP on Windows works really well and there’s lots of great support for all of the major PHP CMS/blogging engines including WordPress, Drupal and Joomla!.

I had a ton of fun at OpenCa.mp and hope to go back if they do it again next year. I’m hoping that next year I can do a full on hour of deep dive technical stuff that will really hit that ninja level that I wanted to cover. As you can tell, I brought way too much material but amazingly I actually hit my time mark perfect (I’ve been working on that).

I was thrilled and honored to be a guest on the WordPress Podcast on WebMasterRadio.fm. This podcast is hosted by my friend Joost de Valk and Frederick Townes. I met Joost back at WordCamp Ireland back in March. That was a fun time. He and I talked about just about everything from being fathers to […]

I met Joost back at WordCamp Ireland back in March. That was a fun time. He and I talked about just about everything from being fathers to deep technical bits comparing various types of caching mechanisms. He even helped me with a number of SEO tips on my web site. Not sure if you’ve noticed but I’m turning up in a lot more searches thanks to him – he knows his stuff. Don’t believe me? Think just for a moment about how competitive this field is and then do a search for WordPress SEO in your favorite search engine and tell me what you think then…

I haven’t actually met Frederick yet but he comes with just a touch of credibility himself being the CTO of Mashable. He’s also the maintainer of the W3 Total Cache plugin. I’m a little jealous of him at the moment though as he’s been based in Florence, Italy for the past year or so… Must be rough.

One thing I will say though is that it’s becoming imperative that I get one of those spankin cartoon avatars.

The show was good but it *flew* by. Before I knew it, the WebMasterRadio dude was IMing us that we had 2 minutes left. All I could think about at points was that I hadn’t even mentioned the SEO toolkit, Windows Live Writer, URL Rewrite and a ton of other stuff that I wanted to get to. Oh well, we talked about a bunch of stuff. Maybe I can convince them there’s enough interesting content to do another show at some point.

So, what I did have time to talk about was a bunch of stuff. We started off with a little bit about me – (which is always a little embarrassing and I hate doing it but it is what it is).

I don’t know if you’ve noticed, but this site (JoshHolmes.com) is actually a WordPress blog as well. I switched over from dasBlog a few months back. dasBlog served me well but it was getting time to move on and WordPress was at the top of the list. Joost was actually the one that convinced me to migrate to WordPress. It didn’t take a tremendous amount of work to do it either. I used DasBlogML to suck out all of the content and then I imported it into WordPress, converted my theme over and was happy.

In addition to WordPress specific things stuff going on at Microsoft, there’s been a lot of support for PHP in general that has gone into IIS, SQL Server and many more of the Microsoft platforms. WinCache, for example, is a great caching tool for PHP on IIS. Just turning it on will result in a 3x or so improvement in performance in PHP on IIS. RuslanY has a great post on getting WinCache support into WordPress. And if you want to see how well it’s working, check out this module that shows you WinCache stats in WordPress. It was written by Kanwaljeet Singla who is the engineer behing FastCGI and WinCache. Cool stuff.

We also chatted about SQL Server a little. Frederick asked me about, to frame it in context for those that are not database or back end nuts, why this was important. It was a good question. In short, there’s a couple of really good reasons why someone would care. The first is that if one is at a company that already has SQL Server, it’s going to make a lot more sense to stand up your WordPress blog on SQL Server rather than introducing a new database engine and more administration to the existing infrastructure. A second great reason is that SQL Server has a ton of fantastic features that WordPress module authors could leverage such as Spatial Data or the fantastic analytics and reporting services that it offers. I teased Joost a little on the podcast about writing a module about that, but I think he knows as well as I do that I was serious as a heart attack that it would be an awesome set of modules. I’m hoping that Joost and others will take that challenge and run with it. If you do, let me know – I’ll be happy to help with whatever technical know-how that you need.

Then we turned to PHP on Azure. This happens to be a passion of mine and I talk about it a lot… I probably rambled a little on it talking about the differences between Infrastructure as a Service (IaaS) and Platform as a Service (PaaS) and what specifically Azure offers. If I was redoing the conversation, I would have cut a little on this conversation in favor of some of the things I didn’t mention such as URL rewrite… Oh well – I’ll do that here.

After that we went back to talking about the plug-ins that we found on http://www.microsoft.com/web/wordpress. There’s a handful of really good ones out there. One that struck Joost’s fancy is the Bing Maps plug in. Using WordPress short code and this plug in, it’s really simple to throw in a Bing Map on your blog.