Step-by-step tutorial on how to create a backend for your web application in the cloud using PHP (Windows Azure)

For all web developers who wish to have a feel of what the “cloud” is like and how easy it is to implement a cloud based back-end for your web application, this is exactly what you have to read.

When I was asked to develop a cloud based system for my University, I was not even sure of what a “cloud-based” system is. I was absolutely new to Windows Azure. But it did not take me long to figure out how to create a back-end for my web application on the cloud. And this step-by-step tutorial should make it easier for all those web designers out there to help you develop a back-end for your web app in Windows Azure and connect to it using PHP.

A step-by-step demonstration of how to create a back-end for your web application in the cloud using PHP:

1. Web Application Deployment:

Step 1: Login to Windows Azure (You need to have an account for this. If you don’t then you should definitely give it a try. Go for the 90 day free trial). On the dashboard click on New –> Compute –> Website –> Custom Create

Step 2: Enter a URL for the web application and choose a geographical location to store your data from the combo box. For database option choose Create a new SQL database. Enter a name for the connection string and click on next.

Step 3: Enter a name for the database and for server choose New SQL Database Server. Provide a login name and password, choose a region to store data and click on next to advance to the next step. Configure advance database settings by specifying the database size and press on the tick mark.

Step 4: The website should be visible in the list of websites. Click on the name of the website and click on WebMatrix to download WebMatrix software.

Step 5: Open WebMatrix. Click on New to open up a window to choose the file type to be created. This is where HTML and/or PHP pages are developed and can be uploaded.

Step 6: Once the code has been added, press on Run. The code is now updated and the webpage opens up.

 

2. Configuring the database in Windows Azure

Step 1: Login to Windows Azure. Click on the website to open the dashboard for the website. Click on Linked Resources to view the database created for the website.

Step 2: Click on the database to open up the dashboard for the database. Click on Manage and enter login details to login.

Step 3: Click on Create new table to create a new table in the database. Once the table is created click on Edit beside the table to add attributes and define their data types.

 

3. Accessing SQL Database from Web Application

Step 1: Login to Windows Azure. Click on the website name –> linked resources –> database name to open up the dashboard for the database. Click on Show connection strings to view the connection string to the database in ADO.NET, ODBC, PHP and JDBC.

Step 2: Using PHP code to connect – it is possible to connect to Windows Azure SQL database using the connection string as follows:

Step 3: The data can be manipulated by embedding T-SQL statements within the PHP code as follows:

Get your free azure trial today: http://www.windowsazure.com/en-us/pricing/free-trial/?WT.mc_id=azurebg_us_sem_branded_trialpage

Advertisements

One response to “Step-by-step tutorial on how to create a backend for your web application in the cloud using PHP (Windows Azure)

  1. Wonderful site you have here but I was curious
    about if you knew of any message boards that cover the same topics talked about in this
    article? I’d really like to be a part of community where I can get comments from other experienced
    people that share the same interest. If you have any recommendations,
    please let me know. Thank you!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s