GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - Tob1as/docker-php: PHP (with Apache2 or FPM or NGINX) - Docker Image for amd64, arm64, arm (Raspberry Pi)

BranchesTags
Open more actions menu

Latest commit

 

History

268 Commits
268 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
conf
conf
 
 
examples
examples
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
alpine.fpm.Dockerfile
alpine.fpm.Dockerfile
 
 
alpine.fpm.slim.Dockerfile
alpine.fpm.slim.Dockerfile
 
 
alpine.fpm.wsc.Dockerfile
alpine.fpm.wsc.Dockerfile
 
 
alpine.fpm_nginx.Dockerfile
alpine.fpm_nginx.Dockerfile
 
 
alpine.fpm_nginx.extended.Dockerfile
alpine.fpm_nginx.extended.Dockerfile
 
 
alpine.fpm_nginx.extended.git.Dockerfile
alpine.fpm_nginx.extended.git.Dockerfile
 
 
alpine.fpm_nginx.slim.Dockerfile
alpine.fpm_nginx.slim.Dockerfile
 
 
alpine.fpm_nginx.wsc.Dockerfile
alpine.fpm_nginx.wsc.Dockerfile
 
 
debian.apache.Dockerfile
debian.apache.Dockerfile
 
 
debian.apache.slim.Dockerfile
debian.apache.slim.Dockerfile
 
 
debian.apache.wsc.Dockerfile
debian.apache.wsc.Dockerfile
 
 
debian.fpm.Dockerfile
debian.fpm.Dockerfile
 
 
debian.fpm.slim.Dockerfile
debian.fpm.slim.Dockerfile
 
 
debian.fpm.wsc.Dockerfile
debian.fpm.wsc.Dockerfile
 
 
dhi.alpine.fpm.wsc.Dockerfile
dhi.alpine.fpm.wsc.Dockerfile
 
 
dhi.alpine.helper.Dockerfile
dhi.alpine.helper.Dockerfile
 
 
dhi.alpine_3_24.fpm.wsc.Dockerfile
dhi.alpine_3_24.fpm.wsc.Dockerfile
 
 
dhi.debian.fpm.wsc.Dockerfile
dhi.debian.fpm.wsc.Dockerfile
 
 
docker-compose.yml
docker-compose.yml
 
 
doi.alpine.fpm.wsc.Dockerfile
doi.alpine.fpm.wsc.Dockerfile
 
 
doi.debian.apache.wsc.Dockerfile
doi.debian.apache.wsc.Dockerfile
 
 
doi.debian.fpm.wsc.Dockerfile
doi.debian.fpm.wsc.Dockerfile
 
 
entrypoint.sh
entrypoint.sh
 
 
k8s.yaml
k8s.yaml
 
 

Repository files navigation

PHP (with Apache2 or FPM or NGINX) on x86_64 and ARM

Supported tags and respective Dockerfile links

  • based on DOI (Docker Official Images) expanded with PHP Extensions and Entrypoint Script for ENV Variables:
    • 8.X-fpm-alpine-slim (Dockerfile)
    • 8.X-fpm-alpine (Dockerfile)
    • 8.X-fpm-alpine-wsc (Dockerfile)
    • 8.X-fpm-nginx-alpine-slim (Dockerfile)
    • 8.X-fpm-nginx-alpine (Dockerfile)
    • 8.X-fpm-nginx-alpine-wsc (Dockerfile)
    • 8.X-fpm-nginx-alpine-extended (Dockerfile)
    • 8.X-apache-debian-slim (Dockerfile)
    • 8.X-apache-debian (Dockerfile)
    • 8.X-apache-debian-wsc (Dockerfile)
    • 8.X-fpm-debian-slim (Dockerfile)
    • 8.X-fpm-debian (Dockerfile)
    • 8.X-fpm-debian-wsc (Dockerfile)
  • based on DOI (Docker Official Images) expanded with PHP Extensions but without Entrypoint Script:
    • 8.X-doi-fpm-alpine-wsc (Dockerfile) (No entrypoint!)
    • 8.X-doi-fpm-debian-wsc (Dockerfile) (No entrypoint!)
    • 8.X-doi-apache-debian-wsc (Dockerfile) (No entrypoint!)
  • based on DHI (Docker Hardened Images) expanded with PHP Extensions but without Entrypoint Script:
    • 8.X-dhi-fpm-alpine-wsc (Dockerfile) (No entrypoint, no shell and nonroot!)
    • 8.X-dhi-fpm-debian-wsc (Dockerfile) (No entrypoint, no shell and nonroot!)

All container images are available in versions 8.3, 8.4 and 8.5. ;-)

How long php versions are supported (End of Life): https://www.php.net/supported-versions.php
Do not use an container image which php version is no longer supported!

What is PHP?

PHP is a server-side scripting language designed for web development, but which can also be used as a general-purpose programming language. PHP can be added to straight HTML or it can be used with a variety of templating engines and web frameworks. PHP code is usually processed by an interpreter, which is either implemented as a native module on the web-server or as a common gateway interface (CGI).

wikipedia.org/wiki/PHP

logo

About these images:

  • based on Docker Official Images (DOI): DockerHub / GitHub
  • For easy install the extensions and get a smaller images it use php-extension-installer.
  • For information about PHP and extensions see here: php.net and pecl.php.net.
  • The official base Images have the following PHP extensions enabled by default (check with: php -m): Core ctype curl date dom fileinfo filter hash iconv json libxml mbstring mysqlnd openssl pcre PDO pdo_sqlite Phar posix random readline Reflection session SimpleXML sodium SPL sqlite3 standard tokenizer xml xmlreader xmlwriter 'Zend OPcache' zlib
  • These images extend the basic images with additional PHP extensions, for example: SQL-Databases, gd, imagick, ldap and more. For details see in dockerfiles.
    • Images with -slim suffix have only the PHP extensions like offical base image, but with entrypoint script for some settings and other adjustments. This is the base image for all others.
    • Images without -slim or other suffix have a mix of additional extensions, which should maybe sufficient for most PHP web applications.
    • Images with -wsc suffix only contain PHP extensions for WSC (WoltLab Suite Core) [Software Download].
    • Images with -extended suffix at present only for php images with nginx. (Prometheus Exporter and other)
    • Images containing apache or nginx are integrated with the web server.
    • Images containing debian or alpine specify the operating system.
    • Images containing doi based on DOI (Docker Official Images) like the other images in this repository, but without an entrypoint script, so the environment variables from this README are not supported. Mount your configuration file(s)
    • Images containing dhi based on DHI (Docker Hardened Images) and NOT based on Docker Offical Images (from Community). This DHI run as nonroot user, do not have a shell and therefore NO entrypoint script. The environment variables listed in the README therefore do not supported here. Mount your configuration file(s). A example setup for docker-compose you can find here and for K8s here.
  • UID:GID:
    • Alpine: 82 (www-data)
    • Debian: 33 (www-data)
    • DHI (Alpine/Debian): 65532 (nonroot)
    • When switching from one Version/OS to another, execute chown -R <UID>:<GID> <FOLDER> before starting the respective container.

How to use these images:

Note: Only works with Images with entrypoint script!

  • Environment Variables:

    • TZ (set timezone, example: "Europe/Berlin")
    • PHP_ERRORS (set 1 to enable, default: disabled)
    • PHP_MEM_LIMIT (set Value in MB, example: 256, default: 128)
    • PHP_POST_MAX_SIZE (set Value in MB, example: 250, default: 8)
    • PHP_UPLOAD_MAX_FILESIZE (set Value in MB, example: 240, default: 2)
    • PHP_MAX_FILE_UPLOADS (set number, example: 25, default: 20)
    • PHP_MAX_EXECUTION_TIME (set Value in Seconds, example: 120, default: 30)
    • CREATE_PHPINFO_FILE (set 1 to enable, for dev and testing)
    • CREATE_INDEX_FILE (set 1 to enable, for dev and testing)
    • PHP-FPM (only):
      • ENABLE_PHP_FPM_STATUS (set 1 to enable on /php_fpm_status)
    • Apache2 (only):
      • ENABLE_APACHE_REWRITE (set 1 to enable)
      • ENABLE_APACHE_ACTIONS (set 1 to enable)
      • ENABLE_APACHE_SSL (set 1 to enable)
      • ENABLE_APACHE_HEADERS (set 1 to enable)
      • ENABLE_APACHE_ALLOWOVERRIDE (set 1 to enable)
      • ENABLE_APACHE_REMOTEIP (set 1 to enable (X-Forwarded-For), use this only behind a proxy/loadbalancer!)
      • ENABLE_APACHE_STATUS (set 1 to enable)
      • ENABLE_APACHE_SSL_REDIRECT (set 1 to enable, required enable ssl and rewrite)
      • APACHE_SERVER_NAME (set server name, example: example.com)
      • APACHE_SERVER_ALIAS (set server name, example: 'www.example.com *.example.com')
      • APACHE_SERVER_ADMIN (set server admin, example: [email protected])
      • DISABLE_APACHE_DEFAULTSITES (set 1 to disable default sites, then add or mount your own conf in /etc/apache2/sites-enabled)
      • APACHE_DOCUMENT_ROOT (set DocumentRoot, default: /var/www/html)
    • NGINX (only):
      • ENABLE_NGINX_REMOTEIP (set 1 to enable (X-Forwarded-For), use this only behind a proxy/loadbalancer!)
      • ENABLE_NGINX_STATUS (set 1 to enable)
      • NGINX_DOCUMENT_ROOT (set DocumentRoot, default: /var/www/html)
      • or mount own config to /etc/nginx/conf.d/default.conf
  • Ports:

    • php with apache/nginx: 80 (http), optional: 443 (https)
    • php with fpm: 9000
  • $ docker run --name phpcontainer -v $(pwd)/html:/var/www/html:rw -p 8080:80 -e PHP_ERRORS=1 -e PHP_UPLOAD_MAX_FILESIZE=250 -d tobi312/php:8.4-apache

  • An own Dockerfile?, then here an example with copy additional own entrypoint-file(s) in apache image:
    $ echo -e "FROM tobi312/php:8.4-apache-debian\nCOPY *.sh /entrypoint.d/" > Dockerfile

Docker-Compose

version: "2.4"
services:
  php:
    image: tobi312/php:8.4-apache-debian
    #image: tobi312/php:8.4-fpm-nginx-alpine
    container_name: phpcontainer
    restart: unless-stopped
    ## ports ONLY with apache/nginx:
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./html:/var/www/html:rw
      ## optional: folder with own entrypoint-file(s) mount:
      #- ./entrypoint.d:/entrypoint.d:ro
      ## optional for apache: own ssl-cert and -key:
      #- ./ssl/mySSL.crt:/etc/ssl/certs/ssl-cert-snakeoil.pem:ro
      #- ./ssl/mySSL.key:/etc/ssl/private/ssl-cert-snakeoil.key:ro
      ## optional for nginx: own nginx default.conf:
      #- ./nginx_default.conf:/etc/nginx/conf.d/default.conf:ro
    environment:
      TZ: "Europe/Berlin"
      PHP_ERRORS: 1
      PHP_MEM_LIMIT: 128
      PHP_POST_MAX_SIZE: 250
      PHP_UPLOAD_MAX_FILESIZE: 250
      PHP_MAX_FILE_UPLOADS: 20
      PHP_MAX_EXECUTION_TIME: 120
      CREATE_PHPINFO_FILE: 0
      CREATE_INDEX_FILE: 0
      ## next env only with apache
      ENABLE_APACHE_REWRITE: 1
      ENABLE_APACHE_ACTIONS: 0
      ENABLE_APACHE_SSL: 0
      ENABLE_APACHE_HEADERS: 0
      ENABLE_APACHE_ALLOWOVERRIDE: 1
      ENABLE_APACHE_REMOTEIP: 0
      ENABLE_APACHE_STATUS: 0
      #ENABLE_APACHE_SSL_REDIRECT: 0
      #APACHE_SERVER_NAME: ""
      #APACHE_SERVER_ALIAS: ""
      #APACHE_SERVER_ADMIN: ""
      #DISABLE_APACHE_DEFAULTSITES: 0
      ## next env only with nginx
      #ENABLE_NGINX_REMOTEIP: 0
      #ENABLE_NGINX_STATUS: 0

This Image on

  • GitHub
  • DockerHub
  • Quay

About

PHP (with Apache2 or FPM or NGINX) - Docker Image for amd64, arm64, arm (Raspberry Pi)

hub.docker.com/r/tobi312/php/

Topics

apache2dhidockerdockerfiledoifpmhttpdnginxnginx-php-fpmphpphp-dockerphp-fpmphp8supervisordwebserverwoltlabwoltlab-suitewsc

Resources

Readme
MIT license
Activity

Stars

14 stars

Watchers

1 watching

Forks

3 forks
Report repository

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.