错误:
致命错误:未捕获的错误:在/var/www/html/index.php中找不到类'mysqli':16堆栈跟踪:#0 {main}在/var/www/html/index.php中抛出16
我制作了index.php文件和PDO mysql连接示例代码。一切正常,除了MySQLi连接。我在docker文件中添加了docker-php-ext-install run命令,但这没有帮助。
这是我的PHP docker文件:
FROM php:7.0-fpm
RUN docker-php-ext-install pdo pdo_mysql mysqli
RUN docker-php-ext-enable mysqli
我的docker-compose.yml文件:
nginx:
build: ./nginx/
container_name: nginx-container
ports:
- 8080:80
links:
- php
volumes_from:
- app-data
php:
build: ./php/
container_name: php-container
expose:
- 9000
links:
- mysql
volumes_from:
- app-data
app-data:
#image: php:7.0-fpm
build: ./php/
container_name: app-data-container
volumes:
- ./www/html/:/var/www/html/
- ./nginx/nginx:/etc/nginx/conf.d
command: “true”
mysql:
#image: mysql:5.7
build: ./mysql/
container_name: mysql-container
expose:
- 3306
ports:
- 3306:3306
volumes_from:
- mysql-data
environment:
MYSQL_ROOT_PASSWORD: secret
MYSQL_DATABASE: zavrel_db
MYSQL_USER: user
MYSQL_PASSWORD: password
mysql-data:
image: mysql:latest
container_name: mysql-data-container
volumes:
- /var/lib/mysql
command: "true"
phpmyadmin:
image: phpmyadmin/phpmyadmin
container_name: phpmyadmin-container
ports:
- 8888:80
links:
- mysql
environment:
PMA_HOST: mysql
谢谢。
答案 0 :(得分:3)
尝试更改数据包名称
php-mysqli
答案 1 :(得分:1)
我通过删除所有图像和容器解决了这个问题。之后,我开始了,一切都很好。
docker rmi $(docker images -a -q)
docker rm $(docker ps -a -q)