alesinicio/php-fullstack

By alesinicio

Updated about 1 year ago

Full stack Alpine-based PHP image with FPM and several extensions available.

Image
Languages & frameworks
0

1.9K

alesinicio/php-fullstack repository overview

DESCRIPTION

Full stack Alpine-based PHP image with FPM and the following extensions installed/enabled/available:

  • Redis
  • PDO
  • MySQLi
  • GD
  • XDebug
  • ZIP
  • OPCache
  • EXIF
  • Mosquitto

Some extensions may be available only on newer tags (PHP8.3.12 forward).

The image comes with tini installed as well.

USE AS FPM CONTAINER

A sample docker-compose.yml with a NGINX webserver looks like this:

services:
    nginx:
        image: nginx:<tag>
        volumes:
            - ./nginx/php.conf:/etc/nginx/conf.d/php.conf
    phpfpm:
        image: alesinicio/php-fullstack:<tag>
        expose: 9000
        volumes:
            - ./php/php.ini:/usr/local/etc/php/conf.d/zzz-php.ini

And the php.conf file should like something like this (don't forget to adjust paths/SSL if needed):

server {
    listen 80 default;
    root /var/www/html;
    index index.php;

    try_files $uri /index.php?$args;
    location ~* \.php$ {
        include fastcgi_params;
        fastcgi_pass php:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_buffers 16 16k;
        fastcgi_buffer_size 32k;
    }
}

USE AS CLI CONTAINER

A sample docker-compose.yml looks like this:

services:
    php:
        image: alesinicio/php-fullstack:<tag>
        volumes:
            - ./php/php.ini:/usr/local/etc/php/conf.d/zzz-php.ini
        entrypoint:
            - /sbin/tini
            - --
        command: php /app/entrypoint.php

USING php.ini

Even though some extensions are installed, not all of them are available, and you should enable (or configure them) via php.ini. Use the docker-compose.yml examples above for instruction on where to mount your own php.ini.

This is a sample php.ini with the most common options. Put your own configuration as needed (JIT, preload, etc...):

extension=mosquitto.so
extension=redis.so
xdebug.mode=debug
xdebug.client_host=host.docker.internal
xdebug.start_with_request=yes

If you are using XDebug, you must be able to connect from the container into the xdebug.client_host (your host machine). In general, for development machines, this means a small change to your docker-compose.yml to make your host discoverable:

services:
    php:
        image: alesinicio/php-fullstack:<tag>
        volumes:
            - ./php/php.ini:/usr/local/etc/php/conf.d/zzz-php.ini
        entrypoint:
            - /sbin/tini
            - --
        command: php /app/entrypoint.php
        extra_hosts:
           - "host.docker.internal:host-gateway"        

Tag summary

Content type

Image

Digest

sha256:b24564d94

Size

46.7 MB

Last updated

over 1 year ago

docker pull alesinicio/php-fullstack:php8.4.1-alpine3.20