klewis
klewis

Reputation: 8360

How to properly connect a custom PHP file with Drupal 8 within Docker, all through docker-compose

I have the following docker compose yml file which spins up both my Drupal 8 site, AND volume path for php under my same Visual Studio Code workspace...


version: '3.9'

services:
  # don't need db or phpmyadmin loaded here because its already running on the network
  drupal:
    image: drupal:8-apache
    ports:
      - '17223:80'
    volumes:
      - ./sb01/sites:/var/www/html/sites'
      - ./sb01/mods:/var/www/html/modules'
      - ./sb01/prof:/var/www/html/profiles'
      - ./sb01/themes:/var/www/html/themes'
    depends_on:
      - mysql_data
    restart: always
    networks:
     - wpsite
  php:
    image: php:7.4-apache
    ports:
      - '9000:80'
    volumes:
      - ./php/php.ini:/usr/local/etc/php/conf.d/my.ini
    networks:
     - wpsite
networks:
  wpsite:
    external: true

But...Drupal's configuration page is not connecting to my custom PHP file for modifications.

What would be a protentional reason for the disconnect between my custom php.ini file and Drupal?

Upvotes: 0

Views: 847

Answers (1)

nelsonenzo
nelsonenzo

Reputation: 680

You are launching two separate containers, with separate file systems. The php container you are launching has nothing to do with the php running in your drupal container.

Try adding the following to your drupal container service definition

volumes:
  - ./php/php.ini:/usr/local/etc/php/conf.d/my.ini

Upvotes: 1

Related Questions