Giter Club home page Giter Club logo

php-template's Introduction

PHP Apache Template

This repository serves as a template for a PHP website running on an Apache webserver. The webserver has been containerized along with a MySQL server. The src directory contains the application code that is running on the webserver.

Prerequisites

This application is built on containerization. While a working understanding of Docker and containerization is recommended, the heavy lifting for this application has already been done. This is a PHP application, thus requiring knowledge of modern PHP practices is recommended. Familiarity with the Apache configuration language and patterns may be required for advanced modification of this application stack. MySQL is used as the database management system (DBMS) in this project.

Getting Started with Docker Getting Started with PHP Apache Web Server Documentation MySQL Documentation

Deployment

The container image comes with a sample PHP + MySQL application for demonstration purposes. To deploy a different site, the image may be rebuilt using different source content, or the /var/www/html directory may be overwritten by a mount point via a container orchestration tool.

Follow the steps below to deploy the sample application:

  1. Clone the repository (or just the docker-compose.yml file)
  2. Create a db.env file with the same keys as db.env.example (fields detailed below)
  3. Run docker compose pull to pull the images from their registries
  4. Run docker compose up to start the application stack
  5. Access the webapp at https://localhost

The database will go through initialization the first time through. This may take a few seconds.

A Makefile is incldued for easy development.

Environment Variables

db.env

The sample application requires a db.env file in the root of the project for MySQL database configuration.

Key Description
MYSQL_ROOT_PASSWORD root user account password
MYSQL_USER Username for connecting to DB
MYSQL_PASSWORD Password for connecting to specified user
MYSQL_DATABASE Name for MySQL database that will be created during initialization

Development

For developing applications, the dev-compose.yml may be utilized for a faster dev experience. It mounts the src/ directory into the /var/www/html directory in the Apache container, allowing saved changes to be instantly available on page reload. Ensure your umask value is set to allow global read & execute on files in src/ or the server will not be allowed to serve them.

The Makefile automatically does a chmod on src/ files and starts the compose stack.

php-template's People

Contributors

kevinharv avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.