Search code examples
phpdockerdrupalbcmath

bcmath extention is enabled in my ubuntu system for php 8.2, but drupal 10 commerce module it is showing error


$ php -i | grep -i bcmath
PHP Warning:  Module "gd" is already loaded in Unknown on line 0
/etc/php/8.2/cli/conf.d/20-bcmath.ini,
bcmath
BCMath support => enabled
bcmath.scale => 1 => 1

my docker compose file setup:

version: '3.8'

services:
  mysql:
    image: mysql:8.0.33
    environment:
      - MYSQL_ROOT_PASSWORD=root
    volumes:
      - mysql_data:/var/lib/mysql
    restart: always
  drupal:
    image: drupal:10
    ports:
      - 8080:80
    volumes:
      - ./web:/var/www/html
      - ./vendor:/opt/drupal/vendor
      - ./composer.json:/opt/drupal/composer.json
      - ./composer.lock:/opt/drupal/composer.lock
    links:
      - mysql
    environment:
      - MYSQL_USERNAME=root
      - MYSQL_PASSWORD=root
    restart: always

volumes:
  mysql_data:

Solution

  • I was using drupal:10 image

    Created a linked Dockerfile with php image mapped to the working directory & i had to add this code to install the bcmath extension inside the container:

    RUN docker-php-ext-install bcmath

    now its working !