當把設定檔貼出來時,答案盡顯眼前。系統有兩個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看一下載入的檔案對不對