can't update php.ini file in Docker container can't update php.ini file in Docker container nginx nginx

can't update php.ini file in Docker container


Add a volumes: section to your php service in the docker-compose.yml file, map a local directory with a custom.ini file to /usr/local/etc/php/conf.d, and restart your container. Whatever valid settings in that file will override those from the main php.ini file. (Incidentally you can do the same with MySQL but not with Nginx).

This works in my own project:

php: volumes: - ./localpath/custom.ini:/usr/local/etc/php/conf.d/custom.ini


i think you have to reload the nginx config.i dont know which OS your php container uses, but try inside of the container some of these:

# /etc/init.d/nginx restart# service nginx restart# nginx -s reload

my logical reason is, that you install php ( and start it at the same time ) and after all you copy the new config.


This is what happened :- If you map the php.ini from host to container, make sure that file (php.ini) must exist on host before you launch the container. Otherwise, the container will not start- Please check if docker was able to read your php.ini file (check permission, sometime docker is running as different user and can't access host file which belongs to root)- Every time you update php.ini, you must restart php-fpm (get inside the container and restart the php-fpm to test, do not rebuild container) , and clear cache (if you enable opcache)