Code Monkey home page Code Monkey logo

docker-apache-phpx's Introduction

Docker, Apache and PHPx

Dockerfiles for running (almost) every minor version of PHP, with Apache.

Based on work originally by Alexander Schenkel.

PHP versions available:

PHP versions maybe coming soon:

  • PHP 5.2

Why?

Because sometimes, you have to work with old software, and it's not immediately straightforward to figure out how to on newer systems!

I put these together primarily as a tool to help me at work, where we're frequently upgrading old versions of WordPress and plugins that won't (yet) work on newer versions of PHP.

Quick Start

For PHP 5.3, for instance:

$ PHP_VERSION=5.3
$ WEB_ROOT=/path/to/your/web/root
$ HOST_PORT=8080

$ docker run --rm --detach --publish ${HOST_PORT}:80 --volume ${WEB_ROOT}:/var/www --name php${PHP_VERSION} tdmalone/docker-apache-phpx:${PHP_VERSION}

This will download the pre-built image for PHP 5.3, and start a container named php5.3 on http://localhost:8080 (loading from the web root you supplied).

When you've finished, you can clean up (and automatically remove the container) by running:

$ docker stop php${PHP_VERSION}

Building

To build the PHP 5.3 image yourself:

$ PHP_VERSION=5.3
$ WEB_ROOT=/path/to/your/web/root
$ HOST_PORT=8080

$ git clone https://github.com/tdmalone/docker-apache-phpX.git
$ docker build --tag php${PHP_VERSION} docker-apache-phpX/php${PHP_VERSION}
$ docker run --rm --detach --publish ${HOST_PORT}:80 --volume ${WEB_ROOT}:/var/www --name php${PHP_VERSION} php${PHP_VERSION}

If you set your web root to the folder that docker-apache-phpX was cloned into (eg. by running WEB_ROOT=$PWD), then you can visit http://localhost:8080/docker-apache-phpX/phpinfo.php to prove that you're running the PHP version you chose.

Development

Ubuntu has been chosen for these Dockerfiles for its ease-of-use and large, well maintained package repository. Wherever possible, LTS releases are used for increased stability.

To assist in creating new images or debugging current ones, you may find these links helpful:

To debug an image, swap --detach with --interactive --tty and add bash to the end, like this:

$ docker run --rm --interactive --tty --publish ${HOST_PORT}:80 --volume ${WEB_ROOT}:/var/www --name php${PHP_VERSION} php${PHP_VERSION} bash

Then run run to simulate what would have happened if you started the container detached.

This repository is linked to an automated build at Docker Hub, with each subdirectory manually mapped to a version tag.

TODO

  • Make files writable by the web server
  • Increase the PHP upload limit to something much larger than the default
  • Make error logs available somewhere easy
  • Further documentation (eg. see Alexander's repo for more of the features he included, such as logging and setting error reporting level via an environment variable)

License

MIT.

docker-apache-phpx's People

Contributors

tdmalone avatar

Stargazers

 avatar

Watchers

 avatar  avatar  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.