Windows Azure offerings aren’t restricted to only Microsoft platforms. In fact, Windows Azure offers the same platform support to run applications built on other platforms – Java, Android, iOS, Node.js, PHP and Ruby.
In this article, we will learn how to migrate a PHP application to run on Windows Azure.
Using Windows Azure Management Portal to Create a PHP Website
First, we need to create a Windows Azure website as the container of our PHP application. This step is very simple.
Navigate to https://manage.windowsazure.com and sign in to your Windows Azure account. You will see the homepage.
Windows Azure Account Homepage
Click on the “WEB SITES” link.
Click on “CREATE A WEB SITE” link.
Create a Website
Give a unique name for your website. For the purpose of demo, I am creating a new Windows Azure Website with the name “testPHPWebsite” and the complete URL as testPHPWebsite.azurewebsites.net. Click on the “Create Website” link at the bottom of the window.
Configuring Window Azure Website for PHP
Next, we will configure the PHP version of our application on Windows Azure.
Click on the website link on the Windows Azure management dashboard.
Click on the Website Link
When we click the link, we will navigate to the website dashboard.
Click on Configure link.
Here, we can specify the PHP version we want for the application.
Specify the PHP Version
Choose the PHP version corresponding to your application and click Save.
Before we deploy our application to Windows Azure, we need to make a few changes.
First, we need to create a user.ini in the root directory of the application and add configuration settings (the same settings that are typically specified in php.ini)
Next, we need to set PHP handler mapping in the handler mappings section. Set all PHP files to be mapped to the file path to php-cgi.exe when the application is deployed to Windows Azure.
To enable extensions, you need to have a property called “PHP_Extensions” (case-sensitive) with a value being the path to the extension as part of the app settings (under Configure tab).
Click Save at the bottom of the window to save your settings before you proceed to deploying your application.
After deploying the application, the website needs to be restarted for the new configuration settings to be picked up.
Our PHP application is now ready for the cloud.
In this article, we learned how to migrate a classic PHP application to run on Windows Azure. I hope you have found this information useful.
About the author
Vipul Patel is a Program Manager currently working at Amazon Corporation. He has formerly worked at Microsoft in the Lync team and in the .NET team (in the Base Class libraries and the Debugging and Profiling team). He can be reached at firstname.lastname@example.org