Skip to content

Latest commit

 

History

History
42 lines (29 loc) · 2.18 KB

php-apache.md

File metadata and controls

42 lines (29 loc) · 2.18 KB

webdevops/php-apache and webdevops/php-apache-dev

webdevops/php plus Apache. Apache serves /app and passes PHP requests to PHP-FPM in the same container.

Tags

8.2, 8.3, 8.4, 8.5 (Debian 12) and 8.2-alpine, 8.3-alpine, 8.4-alpine, 8.5-alpine, for both php-apache and php-apache-dev.

Usage

services:
  app:
    image: webdevops/php-apache:8.5
    ports:
      - "8080:80"
    environment:
      WEB_DOCUMENT_ROOT: /app/public
    volumes:
      - ./:/app

Ports: 80 (HTTP) and 443 (HTTPS). HTTPS uses a self-signed certificate for *.vm that ships with the image; it expired on 2025-05-01. To use your own certificate, see Configuration files.

Services

Started by default: apache, php-fpm, cron, syslog. The -dev variant also starts postfix and ssh.

Configuration

  • Web server settings: Web server. WEB_DOCUMENT_ROOT, WEB_DOCUMENT_INDEX, WEB_ALIAS_DOMAIN and WEB_PHP_TIMEOUT apply to Apache. Apache's own index files (for example index.html and, on Debian, index.php) take precedence over WEB_DOCUMENT_INDEX.
  • PHP and PHP-FPM settings: see webdevops/php and Environment variables.
  • Scripts and hooks: Customization. Apache's hook directory is /opt/docker/bin/service.d/httpd.d.

Development variant (php-apache-dev)

php-apache-dev is built on php-apache and changes the following:

  • Xdebug is loaded by default, as in php-dev; PHP_DEBUGGER switches to Blackfire or turns both off. To connect your IDE, see Xdebug with an IDE.
  • opcache.revalidate_freq is 0.
  • Postfix and an SSH server are started. Postfix sends mail to real recipients unless you set a relay host, see Mail. Unlike php-dev, no passwords are set, so nobody can log in over SSH; use docker compose exec instead, see Known issues.
  • Files matching WEB_NO_CACHE_PATTERN (CSS, JavaScript, images, JSON, XML by default) are served without ETag.