Free trial *Internet Service Required

How to create a PHP web site in Windows Azure Web Sites

This article will show you how to create a PHP web site in Windows Azure Web Sites by using the Windows Azure Management Portal, the Windows Azure Command Line Tools for Mac and Linux, or the Windows Azure PowerShell cmdlets.

In general, creating a PHP web site is no different that creating any web site in Windows Azure Web Sites. By default, PHP is enabled for all web sites. For information about configuring PHP (or providing your own customized PHP runtime), see How to configure PHP in Windows Azure Web Sites.

Each option described below shows you how to create a web site in a shared hosting environment at no cost, but with some limitations on CPU usage and bandwidth usage. For more information, see Windows Azure Web Sites Pricing. For information about how to upgrade and scale your web site, see How to scale Web Sites.

Table of Contents

Create a PHP web site using the Windows Azure Management Portal

When you create a web site in the Windows Azure Management Portal, you have three options: QUICK CREATE, CREATE WITH DATABASE, and FROM GALLERY. The instructions below will cover the QUICK CREATE option. For information about the other two options, see Create a PHP-MySQL Windows Azure web site and deploy using Git and Create a WordPress web site from the gallery in Windows Azure.

To create a PHP web site using the Windows Azure Management Portal, do the following:

  1. Login to the Windows Azure Management Portal.
  2. Click +NEW at the bottom of the page, then click COMPUTE, WEB SITE, and QUICK CREATE. Provide a URL for your web site and select the REGION for your web site. Finally, click CREATE WEB SITE.

    Select Quick Create web site

Create a PHP web site using the Windows Azure Command Line Tools for Mac and Linux

To create a PHP web site using the Windows Azure Command Line Tools for Mac and Linux do the following:

  1. Install the Windows Azure Command Line Tools by following the instructions here: How to install the Windows Azure Command Line Tools for Mac and Linux.

  2. Download and import your publish settings file by following the instructions here: How to download and import publish settings.

  3. Run the following command from a command prompt:

    azure site create MySiteName

The URL for the newly created web site will be http://MySiteName.azurewebsites.net.

Note that you can execute the azure site create command with any of the following options:

  • --location [location name]. This option allows you to specify the location of the data center in which your web site is created (e.g. "West US"). If you omit this option, you will be promted to choose a location.
  • --hostname [custom host name]. This option allows you to specify a custom hostname for your web site.
  • --git. This option allows you to use git to publish to your web site by creating git repositories in both your local application directory and in your web site's data center. Note that if your local folder is already a git repository, the command will add a new remote to the existing repository, pointing to the repository in your web site's data center.

For information about additional options, see How to create and manage a Windows Azure Web Site.

Create a PHP web site using the Windows Azure PowerShell cmdlets

To create a PHP web site using the Windows Azure PowerShell cmdlets, do the following:

  1. Install the Windows Azure PowerShell cmdlets by following the instructions here: Get started with Windows Azure PowerShell.

  2. Download and import your publish settings file by following the instructions here: How to: Import publish settings.

  3. Open a PowerShell command prompt and execute the following command:

    New-AzureWebSite MySiteName

The URL for the newly created web site will be http://MySiteName.azurewebsites.net.

Note that you can execute the New-AzureWebSite command with any of the following options:

  • -Location [location name]. This option allows you to specify the location of the data center in which your web site is created (e.g. "West US"). If you omit this option, you will be promted to choose a location.
  • -Hostname [custom host name]. This option allows you to specify a custom hostname for your web site.
  • -Git. This option allows you to use git to publish to your web site by creating git repositories in both your local application directory and in your web site's data center. Note that if your local folder is already a git repository, the command will add a new remote to the existing repository, pointing to the repository in your web site's data center.

For information about additional options, see How to: Create and manage a Windows Azure Web Site.

Next steps

Now that you have created a PHP web site in Windows Azure Web Sites, you can manage, configure, monitor, deploy to, and scale your site. For more information, see the following links:

For end-to-end tutorials, visit the PHP Developer Center - Tutorials page.

Rss Newsletter