Host WordPress on Windows Azure: Run PHP applications in Windows Azure

 our wordpress live sample website:


Download sample project here


This tutorial article will show you how easy to run PHP applications in Windows Azure. In this tutorial, you will experience the basic process of hosting PHP applications in the cloud with Windows Azure.




1. Firstly, download the latest version of PHP from

VC9 x86 Non Thread Safe (2010-Jul-21 20:38:25) version is your best choice. At right sidebar of the download page, we can see that: VC6 Versions are compiled with the legacy Visual Studio 6 compiler.VC9 Versions are compiled with the Visual Studio 2008 compiler and have improvements in performance and stability.

As for difference between PHP thread safe and non thread safe binaries, please refer here.


2. Open Microsoft Visual Studio elevated as Administrator. From the File menu, choose New and then Project. In the New Project dialog, expand the language of Visual C# .In the Project types list and select Windows Azure Cloud Service. Set the name of the project to "CloudService1".Click OK.


Add CGI_Web Role, rename to PHP_WebCgiRole, Click OK。


3. Create new folder "php" in PHP_WebCgiRole project and extract the downloaded PHP in step1 to the folder "php".


4. Create a new file named "index.php" in PHP_WebCgiRole project.


.Open index.php, add the code below to it:




5. Open Web.roleConfig in PHP_WebCgiRole project.

In the application element, change the fullPath attribute to "%RoleRoot%\approot\php\php-cgi.exe" and set the arguments attribute to an empty string.




6.Open Web.config in PHP_WebCgiRole project,locate the system.webServer section and insert the following (highlighted) configuration:



<defaultDocument enabled="true">
<add value="index.php" />


7. Uncomment the handler named FastCGI Handler.

Change the path attribute of the FastCGI Handler to the string "*.php" to indicate that this handler should process any request for documents with this extension. Next, change the script`Processor attribute to the value "%RoleRoot%\approot\php\php-cgi.exe".



8. Press F5 to debug the application. You may get the error information below. Because Windows Azure will simulate the environment locally, so it requires local IIS to run PHP.


Open My Computer, click Uninstall or change a program, choose Turn Windows feature on or off, in the Internet Information Services,check and enable CGI option:


Now press F5 again, wait for the browser to start, and we'll see:


We can see that the PHP version is 5.3.2.

9.Press Shift+F5. Right click CloudService1 project, Click Publish and choose Create Service Package Only.(you can also choose Deploy your Cloud Service to Windows Azure instead ,refer to here)


After several seconds, we will get 2 files for deployment. Visit Windows Azure portal to deploy the application, then we can visit the application via URL:


Now we run PHP applications in Windows Azure successfully.  



 Windows Azure Platform Training Kit

In This Section





Chapter 1: Using PHP application in Windows Azure

This article will show how easy to run PHP application inWindows Azure

Chapter 2: Consume SQL Azure Using PHP

This article describes how to access SQL Azure using PHP.

Chapter 3: Host WordPress on Windows Azure

This article describes the process about host WordPress on Windows Azure. Similarly, you will see how easy it will be.

Chapter 4: Using Windows Azure Storage in WordPress

This article introduces the Windows Azure Storage plugin for WordPress . It enables WordPress store multimedia contenton Windows Azure Storage.

Comments (10)

  1. George says:


    Is it possible to host an page within this type of web role as well?



  2. pat2 says:

    Yes, In my case. I host mvc2 and php in one webCgiRole.

  3. Charlie says:

    The sample site listed at the top of this page appears to be broken?

  4. PHP Programmer says:

    Thanks for such a great post, and also its explaining about PHP is so nice. I have shared this article through Facebook and Twitter. I will be been keep on visiting your blog, so kindly update the blogs in the same manner.

    <a href=">PHP Developer</a>

  5. PHP Developer says:

    Its so informative and interesting one which i came across recently. Sp my sincere thanks to the author for posting such a great post. The way he expalined about PHP is awesome.

  6. Houmie says:


    Many Thanks for this excellent blog. Unfortunately in the latest August Azure Toolkit the CGI_Web Role has been removed. It is not clear how to follow the steps in this tutorial without that template. May you please be so kind and add a few lines to this blog how this is meant to be done?

    Many Thanks,

  7. php application development says:

    Is it possible to host an page within this type of web role as well?

  8. says:

    Demo does not work…

  9. sqiar says:

    SQIAR…/data-warehousing is a leading Business Intelligence company and provides Data warehousing Services in United Kingdom and USA.

  10. awaisgul says:

    Nice Post <a href="">Urdu tutorials </a>

Skip to main content