Sign inSign up

cenon4dno/php-apache-mysql

By cenon4dno

•Updated over 6 years ago

A simple application for DEMO using Azure App Service with container.

Image
0

181

cenon4dno/php-apache-mysql repository overview

⁠Using Azure App Service with Container for simple PHP/Apache/MySQL App

⁠Intro

Created a simple app, built from PHP/Apache/MySQL that is containerize and place in Azure App Service.

/php-apache-mysql/
├── apache
│   └── demo.apache.conf
├── Dockerfile
└── public_html
    └── index.php
⁠Steps
  • Create a repo, e.g. GitHub or Azure Repos
  • Create a database
  • Create an App Service with Container
  • Create Connection String in the configuration
  • Deployment Center - link Repo to Azure DevOps, will require an ACR
⁠Flow

Code-Image-Azure Flow

⁠index.php
<?php
$host = 'mysql';
$user = 'root';
$pass = 'rootpassword';
$conn = new mysqli($host, $user, $pass);

if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
} else {
  echo "Connected to MySQL successfully!";
}
?>

This code attempts to connect to a MySQL database using the mysqli interface from PHP. If successful, it prints a success. If not, it prints a failed message.

Tag summary

Content type

Image

Digest

Size

141.2 MB

Last updated

over 6 years ago

docker pull cenon4dno/php-apache-mysql