Date: 11/02/2022
By: David Chataway
Website URL: https://david-web-app-dev.azurewebsites.net/
Please use this repository to learn how you can build and deploy a blog using cloud infrastructure. My code was adapted from the great tutorial published by Awa Melvine linked here. I adapted it to utilize Azure resources and also fixed a few bugs.
Although you can choose any infrastructure you'd like, I chose Azure App Service (free F1 plan) and Azure Database for MySQL flexible server (B1s SKU) for cost effectiveness (resulting in $5-$10 per month). App Service has a few tutorials to help you get started (here and here and I found the implementation to be relatively straightforward.
You will need to create your own config file because I have removed mine from the repository. I recommend modifying the base config.php file that Awa Melvine posted, shown below.
<?php
session_start();
// connect to database
$conn = mysqli_connect("localhost", "root", "", "complete-blog-php");
if (!$conn) {
die("Error connecting to database: " . mysqli_connect_error());
}
// define global constants
define ('ROOT_PATH', realpath(dirname(__FILE__)));
define('BASE_URL', 'http://localhost/complete-blog-php/');
?>