Enable mysqli in docker container
·
Answer a question
I build some containers with the following code:
version: '3'
services:
db:
image: mysql:5.7
environment:
MYSQL_ROOT_PASSWORD: test
MYSQL_DATABASE: test
MYSQL_USER: test
MYSQL_PASSWORD: test
ports:
- "9906:3306"
web:
image: php:7.3-apache
container_name: php_web
depends_on:
- db
volumes:
- ./:/var/www/html/
ports:
- "8100:80"
This works like a charm. The only problem what I have is that I need the mysqli module. This one is not included in the php:7.3-apache image.
So what I tried was to add this in the dockerfile:
FROM php:7.3-apache
RUN docker-php-ext-install mysqli
That is not working. So how can I add the mysqli module to my container?
Answers
Do this in your Dockerfile to enable MySQLi:
RUN docker-php-ext-install mysqli && docker-php-ext-enable mysqli
更多推荐



所有评论(0)