Sign inSign up

ambimax/php-7.4-buster

By ambimax

•Updated over 3 years ago

"PHP Docker Image fully configurable by environment variables."

Image
0

2.8K

ambimax/php-7.4-buster repository overview

⁠Ambimax PHP 7.4-buster Dockerimage

New generation of php containers. All settings can be adjusted on the fly by ENV variables.

Currently supported Frameworks and Apps:

  • Symfony
  • Shopware 6
  • Open Mage / Magento 1
  • Magento 2

⁠Environment Variables

All environment variables can be found on https://github.com/ambimax/docker-php/blob/v2/template/components/php/7.4/assets/all.env⁠

⁠End Of Life

NameEnd Of Life
Debian BusterJune, 2024
Alpine 3.6November, 2022

⁠Installed php extensions

All environment variables can be found on https://github.com/ambimax/docker-php/blob/v2/template/components/php/7.4/assets/modules.list⁠

⁠Docker Examples

Show installed version of PHP

docker run --rm  ambimax/php-7.4-buster:latest php -v

Show installed modules of PHP

docker run --rm  ambimax/php-7.4-buster:latest php -m

Mount folder, set env variables and enter

docker run --interactive --tty --rm \
  --env PHP_ERROR_REPORTING=-1 \
  --env PHP_DISPLAY_ERRORS=Off \
  --env "PHP_DATE_TIMEZONE=Europe/Berlin" \
  --volume=$PWD:/app \
  --workdir /app \
  ambimax/php-7.4-buster:latest bash

⁠Docker-Compose Examples

Minimal setup (ensure proper nginx configuration!)

version: "3.7"

services:
    fpm:
        image: "ambimax/php-7.4-buster:latest"
        volumes:
            - "${PWD}/src:/var/www/"
        command: ["php-fpm", "-F"]
        expose:
            - 9000
        networks:
            backend:

    nginx:
        image: nginx:1.19-alpine
        volumes:
            - "${PWD}/config/nginx:/etc/nginx/templates"
            - "${PWD}/src:/var/www/"
        environment:
            API_HOST: fpm:9000
        ports:
            - "8080:80"
        networks:
            backend:

networks:
    backend:

Important: Command (CMD) must be defined!

Extended setup example:

version: "3.7"

services:
    fpm:
        image: "ambimax/php-7.4-buster:latest"
        volumes:
            - "${PWD}/src:/var/www/"
        environment:
            PHP_FPM_LISTEN_PORT: 9002
            FCGI_CONNECT: "localhost:9002"
            PHP_OPCACHE_ERROR_LOG: "/var/www/my.log"
            PHP_OPCACHE_FAST_SHUTDOWN: 1
            PHP_OPCACHE_MAX_WASTED_PERCENTAGE: 10
            PHP_OPCACHE_ENABALE_FILE_OVERRIDE: 1
        command: ["php-fpm", "-F"]
        expose:
            - 9002
        networks:
            backend:

    nginx:
        image: nginx:1.23-alpine
        volumes:
            - "${PWD}/config/nginx:/etc/nginx/templates"
            - "${PWD}/src:/var/www/"
        environment:
            API_HOST: fpm:9002
            TEST: 7.4
        ports:
            - "8800:80"
        networks:
            backend:

    exporter:
        image: hipages/php-fpm_exporter:latest
        ports:
            - "9253:9253"
        environment:
            PHP_FPM_SCRAPE_URI: "tcp://fpm:9002/status"
            PHP_FPM_LOG_LEVEL: "debug"

networks:
    backend:

⁠Healthcheck

A php-fpm-healthcheck⁠ script is installed with Fast-CGI (libfcgi-dev) requirement

Run the following command to check health status of php-fpm:

php-fpm-healthcheck -v

⁠Performance improvements

Use igbinary for serialization:

PHP_SESSION_SERIALIZE_HANDLER: igbinary
PHP_IGBINARY_COMPACT_STRINGS: 1
PHP_APC_SERIALIZER: igbinary

⁠License

MIT License⁠

⁠Authors

Initialized by Tobias Schifftner⁠ for Ambimax GmbH⁠

Tag summary

Content type

Image

Digest

sha256:afb076dce…

Size

140.7 MB

Last updated

over 3 years ago

docker pull ambimax/php-7.4-buster