How to deploy a Laravel 5.4 (PHP) Application to Microsoft Azure WebApp service
Tags: devops, azure, php, laravel
Published: 2017-07-01 16:41:56

---
title: How to deploy a Laravel 5.4 (PHP) Application to Microsoft Azure WebApp service
published: true
description: How to deploy a Laravel Application to Microsoft Azure
tags: Devops, Azure, PHP, Laravel
---

You’ve certainly noticed it, there was just a little silence.
This is mainly due to the change of my employer, after 20 years in an energy company, it has left me in a smaller german “Startup ([ZENNER IoT Solutions](https://zenner-iot.com)), which is costs me some time at the moment (which is completely OK for me!)â€Š–â€Šwhat we do? Building a great IoT Platform!

There we are happy to participate in the Microsoft BizSpark program,
which means some resources, such as testing Microsoft’s Azure Cloud.
Now my task was to bring a PHP application based on the Laravel 5.4 fFramework to a web app from Microsoft. Microsoft WebApps are their PaaS offer when it comes to hosting .. Surprise: Web applications.

The base of the WebApps is an iiS server, which makes the whole story a bit more complex than deploying to a 08/15 Apache with PHP .. the iiS is more suitable for Microsoft’s languages like ASP.NET etc. Well, however, nothing is impossible. Here is a short story on how to deploy a Laravel App to Microsoft Azure WebApp Service (Spoiler: It runs very well, if it runs!).

Let’s assume that your application is finished, and you have already set up 
an Azure WebApp (which is trivial). Now we have to do some preparations.

## PHP Setting for the Azure WebApp

Let â€˜s start with a new PHP version for our WebApp. Fortunately, Microsoft supports PHP 7.1, which we also now select in the Applicationsâ€Š–â€ŠSettings.

![Azure and Laravel](https://thepracticaldev.s3.amazonaws.com/i/14agxl0heta4xiq6i7js.png "Azure and Laravel")

![Azure and Laravel](https://thepracticaldev.s3.amazonaws.com/i/v24asmvj1ev7n6ow0452.png "Azure and Laravel")

## Configure the Azure WebApp for Laravel

Further on the same page, here a few variables we have to set, so that Azure plays well with Laravel.

-SCM_REPOSITORY_PATH to: ..\repository
-SCM_TARGET_PATH to: ..

![Azure and Laravel](https://thepracticaldev.s3.amazonaws.com/i/ibc5vqvb3q9eq7b2vb5k.png "Azure and Laravel")

Now it is time to change the entry point to our website, the default for Azure is “/site/index.html”, but Laravel want’s : “site/public”. But hey we can also do this on the same page.

![Azure and Laravel](https://thepracticaldev.s3.amazonaws.com/i/jjwxfpqttjm2331tmwzi.png "Azure and Laravel")


The matching counterpart to the Apache .htaccess, is the iiS “web.config file, fortunately Laravel ships with a default one, we can use for our application. So no work for us.

## Composer extension for WebApp

The settings now fit, what makes life even easier for us is an extension that you can simply activate, so you make sure that “composer is executed during the deployment and you do not have to do this manually.

![Azure and Laravel](https://thepracticaldev.s3.amazonaws.com/i/1n55iugj6f74ruulegph.png "Azure and Laravel")

![Azure and Laravel](https://thepracticaldev.s3.amazonaws.com/i/uyib7wczed49e4esdryk.png "Azure and Laravel")

![Azure and Laravel](https://thepracticaldev.s3.amazonaws.com/i/yk81s43jf1jfxaxqvamp.png "Azure and Laravel")

## Deployment “pipeline for our Azure WebApp

The last step: Somehow we must get our application to Azure. Personally, I prefer the deployment via GIT, we clone some kind of a local repository and copy our code into it. After a short “git push we are online, Hooray.

![Azure and Laravel](https://thepracticaldev.s3.amazonaws.com/i/axuno343hrt0n09xsy1y.png "Azure and Laravel")

![Azure and Laravel](https://thepracticaldev.s3.amazonaws.com/i/i0rixc5cbx474m7j8686.png "Azure and Laravel")