PHP in Azure

This document is about publishing PHP applications in Microsoft Azure.

Make the PHP application locally

Make your PHP application locally using some IDE.

Run the PHP application locally to check that it works.

Create an Azure Web App

Log into Azure.

Create a "Web App" (from the category "Web + Mobile")

Upload files to your Azure Web App using FTP

Browse to the (empty) Web App and click "Get Publish Profile"

Azure Get Publish Profile

This will give you a file with FTP access information. Look in the later part of the file (the first part of the file is not for FTP) for

Use an FTP client program (like Windows Explorer, not Internet Explorer) to log in. Cut and past the publishUrl from the access information file to the FTP client program: You will be prompted for username and password.

FTP Windows Explorer

Now drag and drop your PHP files from your local computer to Azure. Project files are not needed, only PHP files, images, CSS, etc.

On my computer the PHP files are located in sub-folders of C:\xampp\htdocs

Problem: You have done this before, but for another WebApp

Problem

If you have previously logged with FTP this way to another WebApp, Windows Explorer will keep on logging you into the same old WebApp.

Solution

Build an advanced FTP url with the structure ftp://username:password@ftpserveraddress.
You can build it at the bottom of the "publish settings" file you have downloaded from Azure.
Note that the FTP url will be quite long, since it includes username, password and FTP serveraddress - which are all quite long.
Example (password slightly changed):

ftp://anbo-calculator2\$anbo-calculator2:MGtpQdegkskfyvjFvGksdfksdkQzXhbss7xQrrR7hQ1qzYkdksdfksdfsd@waws-prod-sn1-015.ftp.azurewebsites.windows.net/site/wwwroot

Try your application

Try your application from a browser.

My URL is http://anbo.azurewebsites.net/

Your URL is probably something similar. You find the URL in Azure.