can't update php.ini file in Docker container

前端 未结 3 1967
一生所求
一生所求 2020-12-24 12:55

I\'m trying to set Magento2 on Docker with Nginx & PHP7.

I\'ve added a custom php.ini file as recommended by the PHP7 Docker image. I can see from phpinfo.php t

相关标签:
3条回答
  • 2020-12-24 13:36

    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

    0 讨论(0)
  • 2020-12-24 14:00

    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)

    0 讨论(0)
  • 2020-12-24 14:02

    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.

    0 讨论(0)
提交回复
热议问题