Sign inSign up

ojullien/php-fpm

By ojullien

•Updated over 4 years ago

Another customized PHP-FPM images from the official PHP-FPM Alpine Linux builds

Image
0

1.8K

ojullien/php-fpm repository overview

⁠PHP-FPM images on alpine Linux

Customized PHP-FPM images from the official PHP-FPM Alpine Linux builds⁠.

Oh boy, an another PHP-FPM image. Again ?

Yes, but those one feat my needs. I use those images for my own projects, the configuration files contain the settings and modules I need.

Anyway, feel free to use them for your projects.

⁠Configuration

The images ship with the default php.ini-production configuration file and contain the following enabled modules: gd, pdo_mysql and opcache.

⁠How to use

  • Using Docker CLI, run this command:
docker run --detach --interactive --tty --rm --name my-running-php-fpm \
           --volume /var/www:/var/www --workdir /var/www \
           --publish 127.0.0.1:9080:9000 \
           ojullien/php-fpm:8.0-fpm-alpine
  • Or, using Docker Compose, edit a docker-compose.yml :
version: "3.9"
services:
  php80:
    container_name: my-running-php8.0-fpm
    image: ojullien/php-fpm:8.0-fpm-alpine
    restart: unless-stopped
    volumes:
      - /var/www:/var/www
    ports:
      - "127.0.0.1:9080:9000"

⁠How to update PHP settings

  • Using a Dockerfile:
FROM ojullien/php-fpm:8.0-fpm-alpine
COPY <local conf dir> /usr/local/etc/php/conf.d

And runs the commands:

DOCKER_BUILDKIT=1 docker build --no-cache --tag my-php8.0-fpm .

docker run --detach --interactive --tty --rm --name my-running-php8.0-fpm \
           --volume /var/www:/var/www --workdir /var/www \
           --publish 127.0.0.1:9080:9000 \
           my-php8.0-fpm

Update it and the others conf files as you need. You will buid an up-to-date alpine image.

⁠How to install more PHP extensions

Many extensions are already compiled into the image :

ctypecurl
datedom
fileinfofilterftp
gd
hash
iconv
json
libxml
mbstringmysqlnd
opensslOPcache
pcrePDOpdo_sqlitepdo_mysqlPharposix
readlineReflection
sessionSimpleXMLsodiumSPLsqlite3standard
tokenizer
xmlxmlreaderxmlwriter
zlib

And, to easily install more PHP extensions, we provide a variable that you can pass at build-time to the builder with the docker build command using the --build-arg user_extension=<value> flag. For example, we assume you need the apcu and intl extensions.

First, you need a Dockerfile:

FROM ojullien/php-fpm:8.0-fpm-alpine
ARG user_extension=""
RUN install-php-extensions ${user_extension} \
    && rm -rf /var/cache/apk/*

Then, you may run the commands:

DOCKER_BUILDKIT=1 docker build --no-cache --build-arg user_extension="apcu intl" --tag my-php8.0-fpm .

docker run --detach --interactive --tty --rm --name my-running-php8.0-fpm \
           --volume /var/www:/var/www --workdir /var/www \
           --publish 127.0.0.1:9080:9000 \
           my-php8.0-fpm

Or, you may use Docker Compose and a docker-compose.yml file:

version: "3.9"
services:
  php80:
    build:
      context: <path to the Dockerfile previously created>
      args:
        user_extension: 'apcu intl'
    container_name: my-running-php8.0-fpm
    restart: unless-stopped
    volumes:
      - /var/www:/var/www
    ports:
      - "127.0.0.1:9080:9000"

Note: You may also use the original Dockerfile⁠ used to build the image. This way you will buid an up-to-date alpine image.

⁠Documentation

⁠Contributing

Thanks you for taking the time to contribute. If you have any ideas or if you encounter any bugs, please open an issue⁠.

⁠License

View license information⁠ for the software contained in this image.

As with all Docker images, these likely also contain other software which may be under other licenses (such as Bash, etc from the base distribution, along with any direct or indirect dependencies of the primary software being contained).

As for any pre-built image usage, it is the image user's responsibility to ensure that any use of this image complies with any relevant licenses for all software contained within.

Tag summary

Content type

Image

Digest

Size

34 MB

Last updated

over 4 years ago

docker pull ojullien/php-fpm:8.0-fpm-alpine