Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

108 lines (71 sloc) 7.239 kb

How to create a PHP website in Azure Websites

Overview

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

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

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

[AZURE.NOTE] If you want to get started with Azure Websites before signing up for an account, go to https://trywebsites.azurewebsites.net, where you can immediately create a short-lived ASP.NET starter site in Azure Websites for free. No credit card required, no commitments.

Create a PHP website using the Azure Management Portal

When you create a website in the 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 Azure web site and deploy using Git and Create a WordPress web site from the gallery in Azure.

To create a PHP website using the Azure Management Portal, do the following:

  1. Login to the Azure Management Portal.
  2. Click New at the bottom of the page, then click Compute, Website, and Quick Create. Provide a URL for your website and select the Region for your website. Finally, click Create Website.

    Select Quick Create web site

Create a PHP website using the Azure Command Line Tools for Mac and Linux

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

  1. Install the Azure Command Line Tools by following the instructions here: How to install the 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 website 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 website 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 website.
  • --git. This option allows you to use git to publish to your website by creating git repositories in both your local application directory and in your website'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 website's data center.

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

Create a PHP website using the Azure PowerShell cmdlets

To create a PHP website using the Azure PowerShell cmdlets, do the following:

  1. Install the Azure PowerShell cmdlets by following the instructions here: Get started with 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 website 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 website 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 website.
  • -Git. This option allows you to use git to publish to your website by creating git repositories in both your local application directory and in your website'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 website's data center.

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

Next steps

Now that you have created a PHP website in Azure Websites, 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.

Jump to Line
Something went wrong with that request. Please try again.