Skip to content
Advertisement

PHP date.timezone not found with Docker & PHP-FPM

I’m creating a Symfony environment (PHP-FPM, Nginx, & more) with Docker & Docker-compose.

But, PHP does not use my php.ini and ignores the config (date.timezone parameter is not found in my Symfony application).

Of course, when I go on my container, the date.timezone is correctly set in the 2 php.ini (cli & FPM).

I don’t understand why, but it works if I put my php.ini in /usr/local/etc/php/ folder (wtf)

Did I miss something?

docker-compose.yml :

nginx:
    image: nginx
    volumes:
        - "./docker/nginx/nginx.conf:/etc/nginx/nginx.conf:ro"
    links:
        - "php:php"
    ports:
        - "80:80"
        - "443:443"
    working_dir: "/etc/nginx"

php:
    build: docker/php
    volumes:
        - ".:/var/www:rw"
    working_dir: "/var/www"

Dockerfile :

FROM php:5-fpm

ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update && 
    apt-get install -y php5-common php5-fpm php5-cli php5-mysql php5-apcu php5-intl php5-imagick && 
    apt-get clean && 
    rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

RUN sed -i 's/;date.timezone =/date.timezone = "Europe/Paris"/g' /etc/php5/fpm/php.ini
RUN sed -i 's/;date.timezone =/date.timezone = "Europe/Paris"/g' /etc/php5/cli/php.ini

RUN usermod -u 1000 www-data

Advertisement

Answer

Official PHP Docker Image use /usr/local/etc/php as base folder: see Dockerfile.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement