次の方法で共有


Deploying a PHP App to the Cloud: A Simple App

 

Deploying a Simple PHP Application

As part of Microsoft's continued commitment to interoperability, the Windows Azure platform has been built from the ground up with interoperability in mind. As an open platform, Windows Azure offers you language choices that include .NET, PHP, Ruby, Python, and Java, as well as IDE choices that include Visual Studio and Eclipse. With the support of community-based libraries, development in Java, PHP, and Ruby is made even easier with SDKs especially written for those languages.

Windows Azure is a standards-based platform, enabling interoperability through the support of multiple Internet protocols including HTTP, XML, SOAP and REST.  This allows you to develop solutions that combine components written in different languages and deployed to either traditional hosting or to Windows Azure as you can see in the diagram below.

5

In Deploying a Simple Cloud App on the Canadian Developer Connection I covered deploying a .NET based application from Visual Studio 2010. In this post, we’ll explore how you can do the same with a PHP-based application using your IDE of choice and the Windows Azure Command Line Tools for PHP.

Pre-Work

Before we get started with real work, you’ll need to download and install some pre-requisites. There are two ways to do this – you can download and install using the Microsoft Web Platform Installer or you can perform a manual installation. Click on the links for the method that you’re most comfortable with. Once you’re done with the installations, come back here and we’ll start the walkthrough.

Let’s deploy your simple PHP Cloud App

In Part 1:

  1. You’ll write a small PHP application in Notepad (or your editor of choice).

  2. Once it is written, you’ll test it to make sure that it compiles correctly.

  3. You’ll create a deployment package for Windows Azure and deploy it to the Development Fabric.

    A deployment package contains the service definition for your Cloud solution along with the content and binaries for each of the roles. The package is zipped and encrypted, unless you set an environment variable to have the package created unencrypted.

    The Service Configuration file is kept separate to the service package as it can be updated independently of the service package (updating setting values or increasing/decreasing the number of instances of roles, for example).

  4. The Development Fabric will simulate the Windows Azure environment and allow you to ensure that your application will work when deployed to the Cloud.

    The Development Fabric includes the compute and storage emulators:

    The compute emulator emulates Windows Azure on your local computer. It enables you to run and test your application before you deploy it as a hosted service to Windows Azure.

    The storage emulator emulates Windows Azure Storage, providing local blob, queue, and table storage. It enables you to ensure that your application is correctly using the storage entities before you deploy it to Windows Azure.

Click here to get started with Part 1.

In Part 2:

  1. You’ll create a new hosted service for your PHP Cloud application and in doing so, provision the Windows Azure Web Role instances.

  2. Once provisioned, you’ll test the application in the staging environment to ensure that it works correctly.

    Why is the DNS name for the staging environment different than the one you provided when the hosted service was created? That name (URL prefix) is reserved for the production environment.

  3. You’ll then promote the application from the staging environment to the production environment.

  4. You’ll test it one more time to ensure that the production deployment was done successfully.

Click here to get started with Part 2.

If at any time during your walkthrough you have any questions or are having trouble, feel free to send me an email (cdnazure@microsoft.com). I’ll be more than happy to help.

Please take a moment to share what you thought of the walkthrough, what you’ve learned, and what next steps you’ll take on your journey to the Cloud in this LinkedIn Cloud Development group discussion.

With the simple app deployed successfully to the Cloud, let’s deploy something a little bit more complicated yet much more useful. Check out Deploying a PHP App to the Cloud: WordPress to learn how simple it is to deploy and use WordPress with Windows Azure.