Skip to content
This repository was archived by the owner on Mar 29, 2023. It is now read-only.

MOVED to rimelek/docker-php. PHP images based on the official versions with additional helper scripts

Notifications You must be signed in to change notification settings

rimelek/docker-php-before-2022

Repository files navigation

README

!!! IMPORTANT !!!: The new repository is https://github.com/rimelek/docker-php

Years ago I made a mistake and pushed the repository in a new namespace instead of using GitHub's "transfer" feature so I had two repository with common history. Now I decided to move the project back to the old namespace "rimelek". Since both of the repositories have followers, stars or forks, I keep this repository too, but I recommend everyone to use the new one linked above.


Introduction

This repository contains the source to build multiple PHP versions based on the official Docker images of PHP. For now, the following versions are supported:

  • PHP 5.6 FPM
  • PHP 7.0 FPM
  • PHP 7.1 FPM
  • PHP 7.2 FPM
  • PHP 7.3 FPM
  • PHP 7.4 FPM
  • PHP 8.0 FPM (experimental)

It makes easier to install an extension without knowing which dependencies you need to install or how you have to configure the dependencies before running the official docker-php-ext-install.

Only thing you need to do is specifying which extensions you want to be installed. You can also install every supported extension if you do not specify any extension to install.

The "common" directory is a collection of files that will be copied to each specific PHP version's directory when you run "./prepare -s PATH". Replace PATH with the actual path to a Dockerfile.

Example

./prepare.sh -s 7.4/fpm

Tip:: It is recommended to pull the already built images from Docker Hub.

oci8 and pdo_oci extensions

If you need to use oci8 and pdo_oci extensions, you have to download some files from Oracle's website. Follow the steps below to install the extensions

  • Download the Basic and SDK package of Oracle Instant Client from the official source (you need to accept a license): http://www.oracle.com/technetwork/database/features/instant-client/index.html
  • Copy the contents of instantclient_xx.x directory from each package into <version>/fpm/opt/oracle/instantclient
  • You can build the image now using prepare.sh and docker. See in the next chapter.

Tip: Faster way is building a custom image from existing images on Docker Hub.

FROM itsziget/php:7.4-fpm

COPY oracle/instantclient /opt/oracle/instantclient

RUN re-php-install-ext oci8 && re-php-install-ext pdo_oci

In this case copy the contents of "instantclient" directory to ./oracle/instantclient

Then you can save the new image into your own private repository.

Build an image

Make sure the root folder is writable!

Install all supported extensions:

./prepare.sh -s 7.4/fpm
cd build/7.4/fpm
docker build -t myphpimage .

or install only some specified additional extensions:

./prepare.sh -s 7.4/fpm
cd build/7.4/fpm
docker build --build-arg PHP_EXT_GROUP=none PHP_EXT="gd bz2" --build-arg PECL_EXT_GROUP=none -t myphpimage

You can change 7.4 to any supported version like 5.6, 7.0, 7.1, 7.2 or 7.3

About

MOVED to rimelek/docker-php. PHP images based on the official versions with additional helper scripts

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published