How to enable logging for PHP-FPM inside a container
01:17 28 Oct 2026

I have a multi-container WordPress setup consisting of php fpm + nginx + mariadb + redis.

I need to be able to easily log in php fpm but do not know where the logs go to try to mount a host file on it for inspection or how to modify the log path. Using a php.ini in the root web directory does not seem to work.

Here's my compose file:

services:
  db:
    image: docker.io/library/mariadb:13.0.1-rc
    env_file: env.ini
    
    volumes:
      - dbvol:/var/lib/mysql
      - ./data:/docker-entrypoint-initdb.d:Z
    restart: always
  redis:
    image: docker.io/library/redis:latest
  
  web:
    image: docker.io/library/nginx:1.31.4
    volumes:
      - ./../public_html:/var/www/html:z
      - ./nginx-site.conf:/etc/nginx/conf.d/default.conf:ro,z
    ports:
      - 8000:80
    depends_on:
      - fpm
    env_file: env.ini
    restart: always
    
  fpm:
    build:
      context: .
      dockerfile: Containerfile
    volumes:
      - ./../public_html:/var/www/html:z
      - ./confs/zz-uploads.ini:/usr/local/etc/php/conf.d/zz-uploads.ini:ro,z
      - ./confs/zz-fpm-tuning.conf:/usr/local/etc/php-fpm.d/zz-fpm-tuning.conf:ro,z
    env_file: env.ini
    depends_on:
      - db      
    restart: always
      
    
volumes:
  dbvol: 

I need to be able to turn on and off logging when I want to see the logs written using error_log in a convenient file like public_html/logs/debug.log

wordpress fpm