Docker: Could not find any MySQL database drivers. (MySQLi or PDO required.)

百般思念 提交于 2019-12-23 04:36:39

问题


I'm trying to customize a default PHP image to develop a wordpress plugin locally

This the docker-compose.yml section about wordpress service

  wordpress:
    container_name: wordpress
    build: actual-wordpress
    #image: php:5.5-apache
    volumes:
      -  ./actual-wordpress/www/:/var/www/html/
      -  ./actual-wordpress/wp-config-local.php:/var/www/html/wp-config.php
      -  ./actual-wordpress/srtool/:/var/www/html/srtool/
    depends_on:
      - db
    ports:
      - 8000:80
    restart: always

And this is the 'actual-wordpress' dockerfile being builded

FROM php:5.5-apache

RUN apt-get update; \
    apt-get install -y --no-install-recommends php5-gd php5-mysql

As you can see, I manually install php5-gd php5-mysql

When I run the container, I got this error

Fatal error in /var/www/html/wp-includes/wp-db.php, line 1570. Call to undefined function mysql_connect()
Could not find any MySQL database drivers. (MySQLi or PDO required.)

How can I resolve this issue?


回答1:


docker-php-ext-install mysql mysqli pdo pdo_mysql



来源:https://stackoverflow.com/questions/41955914/docker-could-not-find-any-mysql-database-drivers-mysqli-or-pdo-required

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!