Storage
1. PHP Web Application with Azure MySQL
🎯 Goal
Build a complete PHP web application with MySQL database connectivity by manually provisioning Azure resources through the Azure Portal, then configuring the VM using cloud-init.
📋 Prerequisites
Before beginning this exercise, you should:
- Have an active Azure subscription
- Be familiar with the Azure Portal interface
- Understand basic networking concepts (VNets, subnets, NSGs)
- Have SSH key pair generated (
ssh-keygen -t rsa -b 4096) - Be comfortable with basic Linux commands and file operations
📚 Learning Objectives
By the end of this exercise, you will:
»2. Display Images from Azure Blob Storage in a PHP Web Application
Introduction
In this tutorial, we’re going to guide you through the steps to display images stored in Azure Blob Storage on a PHP web application. This process involves setting up Blob Storage with public access, uploading images to it, and then configuring a PHP web application to retrieve and display these images.
Method
- We will utilize the Azure portal to configure a Blob Storage container, which is anonymously accessible.
- A PHP web application will be developed to serve our images.
- Within the web application, we will use the Azure SDK for PHP to fetch image URLs from Azure Blob Storage.
- The configurations, such as the connection string and container name, will be loaded via environment variables.
Prerequisites
- An Azure account. If you don’t have one, sign up at Azure’s official site.
- Basic familiarity with Azure services and PHP web development.
- Composer installed (PHP dependency manager)
Install Composer
On macOS:
»3. Deploy PHP Blob Storage App to Azure Virtual Machine
Introduction
In this tutorial, we’ll deploy the PHP web application from Exercise 2 to an Azure Virtual Machine. This exercise builds on the previous one where we created a PHP app to display images from Azure Blob Storage. Now we’ll provision an Azure VM and deploy our application to make it accessible over the internet.
Prerequisites
- Completed Exercise 2 (PHP Blob Storage App)
- An Azure account with an active subscription
- Basic understanding of Linux and SSH
- Your PHP application code from Exercise 2
Step 1: Prepare Your Application for Deployment
First, ensure your PHP application is ready for deployment with proper environment configuration.
»