can't update php.ini file in Docker container

走远了吗. 提交于 2019-12-03 01:26:33
otravers

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)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!