Docker - Why do changes to the php configuration file not take effect?
曾经蜡笔没有小新
曾经蜡笔没有小新 2017-06-30 09:52:41
0
4
1685

solve

When the configuration file is posted, the answer is obvious. The system has two PHP files.

  1. php.ini-production

  2. php.ini

I changed it to php.ini -_-!!!

- ./php-fpm/php.ini-production:/usr/local/etc/php/php.ini:ro

Tip Modify the configuration file without deleting docker, just restart docker docker-compose restart

Problem process

If the docker and php configuration files used change, use docker-compose rm and then docker-comose up. Why is there no change when looking at phpinfo()?

Project Directory

Configuration file

docker-compose.yml

# web server
nginx:
  image: nginx:latest
  ports:
    - "80:80"
    - "443:443"
  volumes:
    # app
    - ./app/src:/usr/share/nginx/html
    # nginx configs
    - ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
    - ./nginx/conf.d/:/etc/nginx/conf.d/:ro
    # certificates
    #- ./nginx/ca/server.crt/:/etc/nginx/server.crt:ro
    #- ./nginx/ca/server.key/:/etc/nginx/server.key:ro
  links:
    - fpm:__DOCKER_PHP_FPM__

# php-fpm
fpm:
  build: ./php-fpm
  ports:
    - "9000"
  volumes:
    - ./app/src:/usr/share/nginx/html
    # Your php.ini
    - ./php-fpm/php.ini-production:/usr/local/etc/php/php.ini:ro
  # environment:
    # Set your APP env variables here:
    # - APP_KEY=
    # - DB_HOST=
    # - DB_DATABASE=
    # - DB_USERNAME=
    # - DB_PASSWORD=
  links:
    - mysql:mysql

# database
mysql:
  image: mysql:latest
  ports:
    # Allow client to access 3306
    - "3306:3306"
  volumes:
    # NOTE: your data will be stored in ./mysql
    - ./mysql:/var/lib/mysql
  environment:
    - MYSQL_ROOT_PASSWORD=root123
曾经蜡笔没有小新
曾经蜡笔没有小新

reply all(4)
Ty80

The reasonable explanation is that the php.ini you modified is not the php.ini loaded by running PHP in docker.

Check which path is loaded in php.ini.

三叔

docker rm will delete the modified configuration. You need to configure the local php.ini to map to docker in docker-compose.yml

Ty80

Docker loads php in the image package, it is useless to modify the local one

洪涛

php -i|grep php.ini to see if the loaded file is correct

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template