• I have setup the wordpress using docker-compose. It originally had 2 services,
    – mariadb and – wordpress.

    Later, i have added the 3rd service, SSL certificate. Now the yml file looks like following.

    services:
        #Database
        mariadb:
            image: mariadb:10.4
            volumes:
                - ./database:/var/lib/mysql
            restart: always
            environment:
                MYSQL_ROOT_PASSWORD: password
                MYSQL_DATABASE: shoppee
                MYSQL_USER: user
                MYSQL_PASSWORD: user_password
        #ssl
        ssl:
          build:
            context: ./apache2/
            dockerfile: Dockerfile
          ports:
             - '80:80'
             - '443:443'
          volumes:
            - ./:/var/www/html
            - /home/ubuntu/certs:/var/certs
            - /home/ubuntu/configs/000-default.conf:/etc/apache2/sites-enabled/000-default.conf
            - /home/ubuntu/configs/apache2.conf:/etc/apache2/apache2.conf
        #PHP
        php:
          build:
            context: .
            dockerfile: php.dockerfile
          volumes:
            - ./:/var/www/html
    volumes:
        mariadb:

    when i start the services, I’m getting following error,

    Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /var/www/html/wp-includes/wp-db.php:1688 Stack trace: #0 /var/www/html/wp-includes/wp-db.php(632): wpdb->db_connect() #1 /var/www/html/wp-includes/load.php(545): wpdb->__construct('username_here', 'password_here', 'database_name_h...', 'mysql') #2 /var/www/html/wp-settings.php(124): require_wp_db() #3 /var/www/html/wp-config.php(120): require_once('/var/www/html/w...') #4 /var/www/html/wp-load.php(37): require_once('/var/www/html/w...') #5 /var/www/html/wp-blog-header.php(13): require_once('/var/www/html/w...') #6 /var/www/html/index.php(17): require('/var/www/html/w...') #7 {main} thrown in /var/www/html/wp-includes/wp-db.php on line 1688

    Could please anyone advice on this ? I’m desperately stuck on this one.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator Yui

    (@fierevere)

    永子

    you need to enable MYSQLi extension for PHP

    Thread Starter echomike

    (@echomike)

    Hi Yui,

    Thank you for investigating on this.

    Please find my php.dockerfile here-with. I have already enabled mysqli and nd_mysql

    FROM php:7.2-fpm-alpine
      
    RUN docker-php-ext-install nd_mysqli pdo pdo_mysql && docker-php-ext-enable nd_mysqli
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘[Docker] Uncaught Error: Call to undefined function mysql_connect()’ is closed to new replies.