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
Logo

云原生社区为您提供最前沿的新闻资讯和知识内容

更多推荐