Docker compose update php.ini

Docker compose update php.ini

4 years ago, October 24, 2020
Reading time: 1 mins

How to configure the php.ini in your docker container?

Here is how you can update your config files like php.ini, httpd.conf, php-fpm.conf, .htaccess, etc in a docker container through the host filesystem.

On the root folder of your project where your docker-compose.yml is, add a new file to replace some config file, in your PHP container.

Then on your docker-compose.yml file add a volume to your PHP container

volumes:
 -./<your_local.ini>:/etc/path/to/the/ini/you/want/to/replace/with.ini

Then restart your docker container with --build flag on

docker-compose up --build 

Simple docker-compose YAML file

version: "3"

services:
  php:
    image: php:8.2-apache
    volumes:
      - ./html:/var/www/html:cached
      - ./config/php.ini:/usr/local/etc/php/php.ini
    ports:
      - "8000:80"

I have created a short video explaining how to create a simple PHP project in Docker and update the PHP.INI file to update MAX_EXECUTION_TIME config.

Previous
Update siteurl and home options in wordpress
Next
PiMP Ping-pong / table-tennis Management Platform with real-time scorekeeping function
© 2024 Anil Maharjan