MySQLi not found dockerized php

前端 未结 4 1236
南旧
南旧 2021-01-04 05:06

I\'m trying to dockerize my website. I\'ve got Nginx and PHP up and running and it\'s working find except I can\'t connect to a db. When the page is loaded I get the error:<

4条回答
  •  感情败类
    2021-01-04 05:51

    i had similar issue with
    php:7-apache image, which by default will not have mysqli installed
    you can verify this inside the container

    $ docker exec -it  bash  
    

    inside the docker container bash terminal

    # docker-php-ext-enable mysqli
    

    if mysqli is not installed which you will come to know from the output of above command

    # docker-php-ext-install mysqli
    

    then i commited this change so the same image

    $ docker commit -p  
    

提交回复
热议问题