Skip to content

PHP Container

The PHP container is responsible for serving the backend application and is fully optimized for development workflows.

Dockerfile: devops/{env}/php/Dockerfile

Live reload support

The container monitors changes in PHP files and reloads relevant services when necessary, helping to streamline the development feedback loop.

Composer

Composer is included in the container, allowing you to manage PHP dependencies directly:

docker exec -it barberklingen-<site>-php composer ...

Replace <site> with the appropriate project identifier.

WP-CLI

WP-CLI is installed and configured. Since the environment is based on Bedrock, you can execute WP-CLI commands from the container. Use the --allow-root flag due to the user context inside the container:

docker exec -it barberklingen-<site>-php wp plugin list --allow-root

Replace <site> with the appropriate project identifier.

Service configuration

Property Value
Base image php:7.4-fpm
Dockerfile devops/prod/php/Dockerfile
Depends on mariadb
Network barberklingen-<site>-network
Mount Custom php.ini/usr/local/etc/php/php.ini

Environment variables (via .env):

Variable Purpose
ELEMENTOR_EMAIL Elementor license email
ELEMENTOR_LICENSE Elementor license key
DB_HOST Database host
DB_PORT Database port

Troubleshooting

zz-docker.conf loading order

PHP-FPM loads configuration files in /usr/local/etc/php-fpm.d/ alphabetically. The default zz-docker.conf loads last and silently overrides any earlier pool config — including your custom listen directive.

Symptoms:

  • Pool file sets listen = 9000, but PHP-FPM ends up on 9001
  • Nginx fails to connect to upstream (connection refused)
  • PHP container appears healthy but does not respond on the expected port
  • Logs show errors related to listen or missing sockets

Fix:

Name your custom pool file so it sorts after zz-docker.conf, for example zzz-custom.conf. Choose one port (9000 or 9001) and ensure all pool configs and Nginx upstreams reference it consistently.

Warning

zz-docker.conf is reapplied on every container restart. Verify the active listen port after restarting.