当把配置文件贴出来时,答案尽显眼前。系统有两个PHP文件。
php.ini-production
php.ini
我改是php.ini -_-!!!
- ./php-fpm/php.ini-production:/usr/local/etc/php/php.ini:ro
docker-compose restart
使用的docker,php配置文件改变,使用docker-compose rm 然后 docker-comose up .为什么在phpinfo()看却没有改变呢?
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
合理的解释就是你修改的
php.ini
并不是 docker 中运行 PHP 加载的php.ini
。你查看一下
php.ini
中加载的是哪个路径下的吧。docker rm会把修改的配置删掉的,要在docker-compose.yml中配置本机的php.ini映射到docker
docker 加载的是镜像包里面的 php,修改本机的没用
php -i|grep php.ini看一下加载的文件对不对