Home » Headline | Code | ASP.NET

PHP in the Azure Cloud

1. March 2010 by thebeebs 2 Comments
If I said Windows Azure, Microsoft’s cloud computing platform, supported PHP would it surprise you?

 

I'll be honest, it surprised me. I kept overhearing hushed voices taking about PHP running on Azure, but whenever I asked anyone if they'd actually tried it, they'd stare back blankly.

 

So on Saturday when Eric Nelson asked for topics that we'd like to explore at the Azure Code day in Birmingham, I raised my hand quicker than a hyperactive 5 year old on his first day at school, and blurted out through a mouthful of Blue Smarties, “PHP on Azure! Does anyone else want to look at it with me?” From the corner of the room one man nervously raised his hand, so we broke of from the main room and started investigating if it was possible.

 

I was just interested in getting my hands dirty and discovering if Azure actually supported PHP, my code partner had more pragmatic reasons; he worked for a university and had lots of PHP and open source applications dotted all over the place. He hoped he could unify all of these services along with some .net developments into one single platform.

 

Neither of us had a clue where to start, but after discussing our preconceptions  and 15 minutes of Googling with Bing, we discovered that the support and tooling for PHP on Azure was pretty comprehensive and our task was surprisingly easy.

 

Below I’ve listed the approach we took to get a PHP website in the Azure cloud, over the next three weeks I’ll be porting the PHP Social Network Elgg into the cloud, if you want to get involved contact me here: http://www.thebeebs.co.uk/contact.aspx

 

The Approach

To get running you’ll need to download and install 3 things (this will take around 45 minutes – I said it was easy… not quick)

1. The PHP Azure SDK

2. The Java Development Kit

3. The Eclipse IDE

 

 

One you have Eclipse, you’ll need to Update it to get the Azure add-in: Go to “Help > Install New Software…”

You will then get a window popup, hit the add button.

Next enter the following details:

  • Name: Windows Azure Tools for Eclipse
  • Location: http://www.windowsazure4e.org/update

You’ll then need to hit next a few times and accept some Terms and conditions, it will then start to install the update (now's a good time to get a cup of tea) once it’s finished you’ll need to give the machine a reboot.

Now you’re up to date, you're now ready to build a project. Open Eclipse then Go to File > New > Windows Azure Web Project

This will create a PHP sample application; I called mine “HelloWeb”.

Now you can package the project up and deploy to to Azure. Make sure that the “_WebRole” is selected then go to the Menu Item “Windows Azure > Package Application”

This will create a folder with a few files in it, you’ll need to upload some of these files later on so note down the folder location.

Next you need to go to your windows Azure portal and create a new service.

You are then ready to deploy the files that were created by the packaging, so hit the Deploy button and select the HelloWeb.cspkg and the ServiceConfiguration.cscfg files and enter a label for the deployment, I just entered phpinthecloud, then hit Deploy.

This will upload the files to the cloud, all that is left, is to click on run to start the application (can take up to 5 minutes). The site is then available on the project url:

http://php.cloudapp.net

Congratulations you now have PHP on Azure.

Comments

Add comment


(Will show your Gravatar icon)  

  Country flag

biuquote
  • Comment
  • Preview
Loading