Sign inSign up

nextstage/php

By nextstage

•Updated 1 day ago

Imagens PHP, PHP-FPM e PHP-FPM-APACHE

Image
Languages & frameworks
API management
Web servers
0

50K+

nextstage/php repository overview

⁠Supported versions

  • PHP 8.1, 8.2, 8.3, 8.4, 8.5
  • PHP 7.4 / 8.0: unsupported (legacy in build code, outside VALID_VERSIONS)

⁠Environment variables

⁠General
AUTORUN_ENABLED=true                        # Enable automations (Composer/NPM/Laravel/NSUtil)
AUTORUN_LARAVEL_MIGRATION=false             # Run Laravel migrations
AUTORUN_LARAVEL_REFRESH_CACHE=false         # Clear and rebuild Laravel cache
AUTORUN_LARAVEL_STORAGE_LINK=false          # Create storage symlink
AUTORUN_LARAVEL_STORAGE_PERMISSIONS=0777    # chmod on /storage (e.g. 0777)
AUTORUN_NSUTIL_CLEAR_CACHE=false            # Clear NSUtil cache
AUTORUN_NSUTIL_MIGRATION=false              # Run NSUtil migrations
NSUTIL_USE_TIKA=false                       # Install poppler-utils on boot (Tika OCR)
INSTALL_CRONTAB=true                        # Install project crontab on boot
SHOW_INFO_SYSTEM=false                      # Print sysinfo on boot
DEBIAN_FRONTEND=noninteractive
DOCKER_MAINTENER=your_email
DOCKER_PASS=your_password
DOCKER_USER=your_user
EXTRA_OPEN_BASEDIR=/tmp                     # Extra open_basedir paths
LANG=en_US.UTF-8
LANGUAGE=en_US:en
LC_ALL=en_US.UTF-8
PUID=9999
PGID=9999
S6_BEHAVIOUR_IF_STAGE2_FAILS=2              # 0=continue, 1=restart, 2=stop
S6_LOGGING=0                                # 0=show logs, 1=hide
WEBUSER_HOME=/var/www/html
⁠Embedded PostgreSQL

Enabled when DBHOST=localhost and DBTYPE=postgres. Restore via flag at RESTORE_FLAG (/var/lib/postgresql/backup/restore.flag).

DBHOST=localhost
DBTYPE=postgres
⁠Apache (fpm-apache / fpm-apache-dev)

FPM/Apache sizing: https://optimizer.nextstage.com.br⁠

APACHE_DOCUMENT_ROOT=/var/www/html/api/
APACHE_HTTP_PROTOCOLS="h2 h2c http/1.1"
APACHE_MAX_CONNECTIONS_PER_CHILD=100
APACHE_MAX_REQUEST_WORKERS=50
APACHE_MAX_SPARE_THREADS=25
APACHE_MIN_SPARE_THREADS=5
APACHE_RUN_GROUP=webgroup
APACHE_RUN_USER=webuser
APACHE_SERVER_ADMIN=webmaster@localhost
APACHE_SERVER_LIMIT=16
APACHE_SERVER_NAME=localhost
APACHE_START_SERVERS=2
APACHE_THREAD_LIMIT=32
APACHE_THREADS_PER_CHILD=25
APACHE_TIMEOUT=120
APACHE_CSP_ALLOWED_PATHS_ALL=""             # Routes embeddable from any origin (e.g. /dash,/queue)
APACHE_CSP_ALLOWED_PATHS_DOMAIN=""          # Routes embeddable from listed domains
APACHE_CSP_ALLOWED_DOMAINS=""               # Domains for PATHS_DOMAIN (e.g. abc.com xyz.net)
⁠Nginx (fpm-nginx / fpm-nginx-dev)
NGINX_WORKER_PROCESSES=auto
NGINX_WORKER_CONNECTIONS=1024
NGINX_KEEPALIVE_TIMEOUT=65
NGINX_CLIENT_MAX_BODY_SIZE=100M
NGINX_SERVER_NAME=localhost
NGINX_RUN_USER=webuser
NGINX_RUN_GROUP=webgroup
NGINX_DOCUMENT_ROOT=/var/www/html/api/
NGINX_TIMEOUT=120
NGINX_LOG_LEVEL=info                        # info, debug, warn, error
NGINX_EXTRA_CONFIG=""                       # Extra server-block snippet
NGINX_CSP_ALLOWED_DOMAINS=""
PHP_PROCESSOR_TYPE=fpm                      # fpm or swoole
⁠PHP-FPM
PHP_DATE_TIMEZONE=UTC
PHP_DISPLAY_ERRORS=Off
PHP_ERROR_REPORTING="E_ALL & ~E_NOTICE & ~E_STRICT"
PHP_MAX_EXECUTION_TIME=30
PHP_MEMORY_LIMIT=256M
PHP_PM_CONTROL=dynamic                      # static / dynamic / ondemand
PHP_PM_MAX_CHILDREN=86
PHP_PM_MAX_SPARE_SERVERS=4
PHP_PM_MIN_SPARE_SERVERS=2
PHP_PM_START_SERVERS=4
PHP_POOL_NAME=www
PHP_POST_MAX_SIZE=20M
PHP_UPLOAD_MAX_FILE_SIZE=20M
⁠OPcache
OPCACHE_ENABLE=1
OPCACHE_ENABLE_CLI=1
OPCACHE_FAST_SHUTDOWN=1
OPCACHE_INTERNED_STRINGS_BUFFER=8
OPCACHE_MAX_ACCELERATED_FILES=4000
OPCACHE_MEMORY_CONSUMPTION=128
OPCACHE_REVALIDATE_FREQ=600
⁠Xdebug (*-dev)

Available on cli-dev, fpm-apache-dev, and fpm-nginx-dev.

XDEBUG_CLIENT_HOST=host.docker.internal
XDEBUG_CLIENT_PORT=9003
XDEBUG_DISCOVER_CLIENT_HOST=0
XDEBUG_MODE=debug
XDEBUG_OUTPUT_DIR=/var/log/xdebug
XDEBUG_START_WITH_REQUEST=yes
⁠Embedded Redis

Starts local Redis when REDIS_HOST is localhost or 127.0.0.1. Persistence path: /var/lib/redis/data — mount a volume if needed.

REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_MAXMEM=256mb
REDIS_PASSWORD=""
REDIS_PERSIST=true

⁠Notes

  1. Images: Apache → fpm-apache*; Nginx → fpm-nginx*; Xdebug → *-dev; FPM → fpm and web-server variants.
  2. Override: docker run -e VARIABLE=value ...
  3. Interdependencies: PHP_PM_CONTROL affects PM vars; APACHE_THREAD_LIMIT ≥ APACHE_THREADS_PER_CHILD.
  4. Security: open_basedir, session.cookie_secure, CSP frame-ancestors (default 'self').
  5. Performance: OPcache on; FPM dynamic; Apache mpm_event. Initial sizing: https://optimizer.nextstage.com.br⁠
⁠CSP (Apache) — examples

By default only the same origin may embed (frame-ancestors 'self').

# /dash and /queue: any origin
APACHE_CSP_ALLOWED_PATHS_ALL="/dash,/queue"

# /dd: abc.com only
APACHE_CSP_ALLOWED_PATHS_DOMAIN="/dd"
APACHE_CSP_ALLOWED_DOMAINS="abc.com"
⁠Docker Compose example
services:
  app:
    container_name: php_app
    hostname: your-hostname-to-container
    restart: always
    image: nextstage/php:${PHP_VERSION}-fpm-apache
    ports:
      - 80:80
    volumes:
      - .:/var/www/html
      - ../persist/redis-data:/var/lib/redis/data
    env_file:
      - ./.env
    extra_hosts:
      - "host.docker.internal:host-gateway"

⁠License

MIT — see LICENSE⁠.

Tag summary

Content type

Image

Digest

sha256:4a8602cf8…

Size

475 MB

Last updated

1 day ago

docker pull nextstage/php:8.5-fpm-apache-dev-trixie