I found the official docker compose version of Drupal on the official Docker Hub site - Docker Hub
I was able to get it up and see Drupal on my local development environment. But how can I take this further and apply a custom PHP.ini file to the process so that I can customize PHP commands for the given Drupal environment in my container? What could the Docker Compose “potentially” look like in this case?
you could try and follow the php repo guide on how to add configurations ( Docker Hub)
Configuration
This image ships with the default php.ini-development and php.ini-production configuration files.
It is strongly recommended to use the production config for images used in production environments!
The default config can be customized by copying configuration files into the $PHP_INI_DIR/conf.d/ directory.
So just to be on the same page as what you said initially with mounting a local copy, in theory the following example below should be good enough…correct?
@Terpz, thanks for baring with me up to this point. I was successful in spinning up Drupal and a volume location for PHP, but for some reason Drupal is not recognizing my .ini file or code inside of it. Based on my docker compose below, would there by anything I could try to do differently to get my custom PHP file in my volume, to talk to Drupal?
version: '3.9'
services:
# don't need db or phpmyadmin loaded here because its already running on the network
# find the site location at http://docker.drupalphp:17223
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
My folder structure
My code inside of php.ini
display_errors = On
#display_startup_errors = Off
#error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
log_errors = On
upload_max_filesize = 9M
post_max_size = 17M
Yet, when I go to the PHP info() page within the configuration section of Drupal, there is no change for post_max_size being 8M.
Where should I improve my code to make a connection…
I got it solved. The Drupal image already contains PHP. Instead of adding a separate PHP service, I had to mount my custom php.ini to my drupal service.