Git Product home page Git Product logo

docker-php-5.3-alpine's Introduction

PHP 5.3 alpine based images

PHP 5.3 reached EOL on 14 Aug 2014 and thus, official docker support was dropped. I still needed to run 5.3 with FPM so I built this image based on the latest official builds of PHP.

Images

This repo provides the following images:

  • cespi/php-5.3:cli-latest
  • cespi/php-5.3:apache-latest
  • cespi/php-5.3:fpm-latest

All images are build from alpine 3.4 following the same criteria used to build current php library docker images

Images with additional PHP modules commonly used

Selected modules are commonly used by our organization. This images are:

  • cespi/php-5.3:modules-cli-latest
  • cespi/php-5.3:modules-apache-latest
  • cespi/php-5.3:modules-fpm-latest

How we use it

We define a bash script to work using php cli as follow:

  1. Place the scripts from this repo at vendor/bin in $HOME/bin/
  2. Set an env variable named PHP_CLI_DOCKER_IMAGE with the image of a docker php cli image. For example: PHP_CLI_DOCKER_IMAGE=cespi/php-5.3:modules-cli-latest
  3. Set an env variable named PHP_SERVER_DOCKER_RUN_OPTIONS with additional docker run arguments.

You can then add this variables to your environment editing your .bash_profile or .bashrc, or instead use direnv, so you can personalize a docker environment per project.

Install scripts

Run the following command:

mkdir -p $HOME/bin && \
  curl https://raw.githubusercontent.com/Desarrollo-CeSPI/docker-php-5.3-alpine/master/vendor/bin/php -s \
  > $HOME/bin/php && chmod +x $HOME/bin/php && \
  curl https://raw.githubusercontent.com/Desarrollo-CeSPI/docker-php-5.3-alpine/master/vendor/bin/php-server -s \
  > $HOME/bin/php-server && chmod +x $HOME/bin/php-server

Make sure $HOME/bin is the first entry on your $PATH

If php-server gives the following error:

Variable PHP_SERVER_LOCAL_PHP_INI must be set with a valid php ini file. It now
points to /home/car/bin/etc/docker/php/php.ini, but file seems to not exist

You must set PHP_SERVER_LOCAL_PHP_INI with a valid php ini file

Sample personalization per project using direnv

PHP_CLI_DOCKER_IMAGE=cespi/php-5.3:modules-cli-latest
PHP_SERVER_DOCKER_RUN_OPTIONS="--add-host local.docker:172.17.0.1 -e APACHE_RUN_USER=$USER -e APACHE_RUN_GROUP=`id -ng $USER` -v $HOME/docker/php/php.ini:/usr/local/etc/php/conf.d/my-custom-php.ini:ro"

Then, in any directory you can run php scripts or php-server script to launch a php web server

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.