views:

51

answers:

3

I'm investigating the possibility of hosting a CMS (wordpress written in php) on Azure. I'm already running an ASP.NET Web Role which exposes WCF services. WordPress requires PHP. All my research suggests that I should create a new CGI Web Role to handle the PHP functionality. Is it possible to run the CGI Web Role and the ASP.NET Web Role under a single Azure instance? Or will I need two instances (one for asp.net; other for cgi)?

A: 

The flexibility of the Worker role enables you to run almost anything, including IIS itself :) You can use a role to host your own instance of IIS Hostable Web Core, which can leverage a few more of the features of IIS (like multiple applications) and likely enable you to do what you are wanting with a single instance. I don't have a ton of experience doing this myself, just know its possible.

The best example I've seen is at Steve Marx's blog http://blog.smarx.com/posts/build-your-own-web-role-running-hosted-web-core-in-windows-azure

Beyond that, search around for "hostable web core on Azure" and you'll find some good resources.

Taylor
A: 

You should look at the latest Windows Azure Companion that will let you do this. This will install an administrative website in a worker role and let you then install PHP-based tools such as WordPress, along with PHP itelf, via menu.

If you look at the source code of the Azure Companion, you'll see how the hosted web core is being launched. If you need to customize things beyond what the companion lets you do, you have all the code you need right there.

In a worker role, you can host multiple TCP ports, so it's very reasonable to have background workers running in the same role instance as your WordPress site.

Slightly unrelated: In a Web Role, you can still have background processes, but you'll just be unable to open arbitrary ports. You'll be fine creating, say, queue listeners. Just fire up your code in the Run() method (you'll need to add this, as it doesn't get added by default with a Web Role, only in the Worker Role template).

David Makogon
A: 

Actually, the "CGI Web Role" is just a web role with some FastCGI settings already populated. You can still put ASP.NET (or WCF services) there alongside the PHP. See http://blog.smarx.com/posts/php-asp-net-in-windows-azure for an example (but the demo app is no longer up).

smarx