DEV Community

JICDev
JICDev

Posted on • Edited on

Deploying a PHP Web App to Azure App Service CI/CD Pipelines

What You’ll Learn

  • How Azure App Service works
  • How to set up a PHP environment on Azure
  • How to upload and host your PHP files
  • Common setup errors (and how to fix them)

What is Azure App Service?

Azure App Service is a managed platform by Microsoft that lets you easily deploy and scale web applications.

Think of it as your own web server in the cloud — no need to install Apache or Nginx, Azure takes care of all of that.

It supports multiple programming languages:

  • PHP
  • Python
  • Node.js
  • Java
  • .NET

For this tutorial, we’ll use the PHP runtime stack.


Prerequisites

Before you begin, make sure you have:

  • A Microsoft Azure account (Create one here)
  • A PHP project (with at least index.php i.e ## Example: Simple PHP App

If you want to test Azure’s setup, try this simple app:

<?php
echo "<h1>Hello Azure</h1>";
echo "<p>This is my first PHP app on Azure App Service.</p>";
?>
Enter fullscreen mode Exit fullscreen mode

Save this as index.php and upload it to /site/wwwroot.

---)

  • A stable internet connection

Step 1: Create a Web App on Azure

Step 1.1: Go to Azure Portal

Visit https://portal.azure.com


Step 1.2: Search for “App Services”

In the top search bar, type App Services, then click CreateWeb App


Step 1.3: Configure the Basics

Fill out the required information:

Setting Description Example
Subscription Choose your active Azure subscription Pay-As-You-Go
Resource Group Create new php-demo-rg
Name Your app’s unique name my-php-app-demo
Publish Code
Runtime Stack PHP PHP 8.3
Operating System Linux
Region Closest to you West Europe
App Service Plan Create new php-service-plan

Why this matters:
The App Service Plan defines the CPU, memory, and scaling limits for your app.


Step 1.4: Deployment Settings

Choose:

Deploy manually (no CI/CD for now)

You can connect GitHub later if you want continuous deployment.


Step 1.5: Review + Create

Click Review + Create, then Create.
Azure will deploy your web app — this usually takes 2–3 minutes.

Step 2: Upload Your PHP Files

Once your web app is deployed, upload your project files.


Step 3: Connect GitHub for Continuous Deployment

If you want Azure to automatically redeploy your app whenever you push updates to GitHub:

  1. Open your App Service → Deployment Center
  2. Choose GitHub as the source
  3. Select your repo and branch
  4. Save settings

Now, every GitHub push automatically redeploys your app.


Step 4: Test Your Website

Open your browser and visit:

https://yourappname.azurewebsites.net


![ ](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q9wteiinpp2i0yejd2if.png)


Enter fullscreen mode Exit fullscreen mode

If everything went well, your PHP app should now be live.


Option ways to upload your Php files to Azure Web App

Option 1: Upload via Azure Portal

  1. Open your App Service from the Azure dashboard
  2. Go to Development Tools → Advanced Tools → Go → Open Kudu
  3. Click Debug Console → CMD
  4. Navigate to /site/wwwroot
  5. Drag and drop your PHP files (e.g. index.php, style.css, etc.)

Note:
The /site/wwwroot directory is the public folder Azure serves to users.


Option 2 : Upload via FTP

If your project has many files, use FTP.

  1. Go to your App Service → Deployment Center → FTP
  2. Copy the FTP Hostname, Username, and Password
  3. Open FileZilla
  4. Upload your PHP files into /site/wwwroot

Common Errors and Fixes

Error Cause Solution
404 Not Found Wrong folder or missing index.php Make sure your files are in /site/wwwroot
Blank Page PHP version mismatch Check your runtime stack in App Settings

Tip: Restart your App Service after uploading new files.


Understanding What’s Happening Behind the Scenes

When you create a Web App:

  • App Service Plan defines your hosting resources (CPU, memory, scaling)
  • Web App is your hosted website instance
  • wwwroot is the public directory
  • PHP Runtime Stack is Azure’s PHP environment that executes your code

Step 5: Optional – Add a Custom Domain

If you want to use your own domain (like www.myportfolio.com):

  1. Go to your App Service → Custom Domains
  2. Add your domain name
  3. Update your DNS records using Azure’s values

Lessons Learned

When I first did this:

  • I once had a blank page — caused by using the wrong PHP version.
  • After re-uploading my files and restarting the app, everything worked.

Conclusion

Deploying a PHP web app to Azure App Service is straightforward once you understand how the pieces fit together.

To summarize:

  1. Create a Web App using the PHP runtime
  2. Upload your project to github then connect to the Azure for CI/CD
  3. Test it at your azurewebsites.net URL

You now have a PHP site hosted in the cloud!


Next Steps

In a future post, I’ll cover how to:

  • Automate deployments using GitHub Actions so do well to follow me not to miss out

Top comments (0)