Windows Azure Loves Open Source at Make Web Not War Conference

Microsoft held it’s Make Web Not War conference in Montreal on May 27th 2010.

mwnw[1]

I was asked to present on the Windows Azure Platform for a CodeFest audience consistly largely of open source developers.

Here’s the Windows stack using Azure across from the LAMP stack.

20100606 cross-plat

I discussed how to mix and match a these things, so here’s a summary of some of the interoperability points and resources mentioned at the event.

Windows Azure Storage accessible from .NET and PHP

Windows Azure storage is a hugely scalable storage system with a REST-based interface accessible to systems that can talk XML over TCP.

As well as client libraries for .NET applications, there’s also the Windows Azure SDK for PHP (CTP on CodePlex – BSD License).

Windows Azure Hosting & Tools for ASP.NET apps built with Visual Studio and PHP apps bulit with either Eclipse or the Command Line

Windows Azure provides for scalable hosted applications running within the IIS platform (including FastCGI-enabled interpreters like PHP) as well as native Win32 applications (which could include your open server application listening on TCP ports).

Of course there’s a set of Visual Studio tools for developing ASP.NET applications on IIS.  There’s also Windows Azure Tools for Eclipse (windowsazure4e.org) for developing your PHP application in Eclipse to run under IIS FastCGI on Windows Azure.

And if you don’t want to use an IDE there’s also Windows Azure Command-line Tools for PHP (CTP on CodePlex – BSD License).

SQL Azure accessible from .NET and PHP applications

SQL Azure (talking just minutes – seriously like 3 minutes -  to set up a database in the cloud) provides reliable database storage in the cloud.

You can access this from ADO.NET and ODBC clients using the TDS+SSL protocol.  You can also use the SQL Server Driver for PHP 1.1 (or the 2.0 CTP) to access your cloud database from a PHP application.

MySQL hosted on Windows Azure

Yep, there’s a solution for that too – see the Solution Accelerator for MySQL & PHP on Azure

Getting Started with PHP on Windows Azure

This post will get you started with PHP development in Visual Studio for deployment to Windows Azure.

Using the FastCGI capabilities of IIS you can run PHP application on IIS and Windows Azure (in your local Development Fabric on in the Windows Azure cloud).

So, here’s how to create a simple PHP application in Visual Studio 2010 on Windows 7.

If you want to see this in video, check out my screencast interview with Dot Net Rocks TV on Azure and go to point 48:40.

  • Download the latest Windows ZIP files from http://windows.php.net/download/ (currently 5.3.2).  You should get for the VC9 x86 Non Thread Safe version.  The FastCGI system on IIS makes the use thread-safe.  Unzip the files into a folder somewhere on your system and rename the folder "PHP".
  • Ensure you have everything for IIS and CGI (i.e. FastCGI) is activated on your system for local development. 
  • Install the latest Azure SDK (checking the system requirements) – currently 1.1 (Feb 2010).
  • Start Visual Studio 2010 (which must be in run as an Administrator for the current version of the SDK) and create a new VS Cloud Project…

azphp1

  • Add the CGI Web Role…

azphp2

  • Open an Explorer window and locate your downloaded and extracted PHP folder.  Do a Copy on the PHP folder.
  • Open the folder for the web project…

azphp3

  • Paste the PHP folder (and therefore subfolders) into the web project folder and then select the Show All Files option in Solution Explorer so you can see the pasted PHP folder…

azphp4

 

  • Use the "Include in Project" option on the php folder to include it in project files, and therefore in the files deployed to Azure.

azphp5

  • Edit the Web.roleconfig file, (putting a new <application/> tag in place like this which tells IIS (locally or in the cloud) about the FastCGI interpreter for PHP…

azphp6

  • Edit Handers section of the Web.config file to include this new <add/> tag which tells IIS to use the PHP interpreter for files ending with .PHP…

 azphp7

  • Also add the new <defaultDocument/> tag above to set up "index.php" as the default document for the web application.
  • Finally add a basic index.php file using Add New Item on the web project; since there is no .PHP item – use a .TXT item (in the General category) and give the new file a .PHP extension…

azphp8

  • Enter this basic PHP code:

<? phpinfo(); ?>

  • Start up the application and you should see something like the following:

azphp9

You can now deploy this (or a real application) to Azure using the Publish function on the Cloud project as usual.

Check out this MSDN page for general help on using FastCGI interpreters with Azure.

Enjoy! 🙂

Microsoft and Open Source Communities are sponsoring the Make Web Not War conference on May 27th 2010, showcasing the latest cross-platform techniques and technologies, including presentations, panels, workshops, a codefest, the FTW coding competition and a party!  Open Data, HTML 5, PHP, JQuery, Mobile, SEO and the Cloud, are amongst the topics being covered.  Speakers and panelists will include myself, Microsoft Canada team members and many open source experts.

Make Web Not War