Bynd
Bynd

Reputation: 705

Cannot edit php.ini file in Docker

I'm trying to edit the php.ini inside Docker, so I need to do docker-compose up. But every time I do docker-compose up, php.ini returns as it was before.

Upvotes: 0

Views: 2507

Answers (1)

Adiii
Adiii

Reputation: 60074

Better to mount the php.ini from the host, as docker-compose up will terminate the container and will launch a new container which does not container the modified php.ini.

volumes:
   - ./config/custom.php.ini:/etc/php(version)/apache2/conf.d/custom.php.ini

By default the scan directory for extra php files will look in the conf.d directory. These files will overwrite the settings of the main php.ini. I tested this with the asp_tag option turning it Off and On. It works fine as long as you do the following below.

The trick to making this work is to use docker-compose down instead of docker-compose kill

you can check further here and here

Upvotes: 2

Related Questions