I have been using the following docker-compose.yml to build a WordPress environment. Everything has been working fine, except when I attempt to use PHP function
I receive an undefined function error.
Could anyone explain to me what I need to add to the YML file in order to include the PHP
extension?
I have attempted to include PHP extensions by inserting the following two lines:
And then created a Dockerfile inside ./docker/php with
But I receive
when I run docker-compose build
Code:
easter_date()
Could anyone explain to me what I need to add to the YML file in order to include the PHP
Code:
easter_date()
Code:
version: '3.3'
services:
db:
image: mysql:5.7
volumes:
- ./data:/docker-entrypoint-initdb.d # This will import DB data from an sql file in your /data folder
- ./data/migrate.sql:/docker-entrypoint-initdb.d/migrate.sql # run sql commands in migrate.sql to update site urls in DB
restart: always
ports:
- "3400:3306" # mapping our ports for networking
environment:
MYSQL_ROOT_PASSWORD: wordpress
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
phpmyadmin:
image: phpmyadmin/phpmyadmin
restart: always
ports:
- "8080:80"
environment:
PMA_HOST: db
MYSQL_ROOT_PASSWORD: wordpress
DOCKER_COMPOSE_YML_LOCATION: wordpress
container_name: wp_phpmyadmin
wordpress:
build:
context: .
depends_on:
- db
image: wordpress:latest
ports:
- "3500:80" # mapping our ports for networking
restart: always
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: wordpress
WORDPRESS_DB_NAME: wordpress
WORDPRESS_DEBUG: 1
WORDPRESS_MEMORY_LIMIT: 256MB
working_dir: /var/www/html
volumes: # this is where we tell Docker what to pay attention to
- ./wp-content:/var/www/html/wp-content
- ./uploads.ini:/usr/local/etc/php/conf.d/uploads.ini # create custom uploads.ini which has an increased upload file size limit, memory etc.
volumes:
db_data: {}
I have attempted to include PHP extensions by inserting the following two lines:
Code:
php: #https://stackoverflow.com/questions/46401966/install-packages-from-docker-compose-yml-into-docker-container
build: './docker/php'
And then created a Dockerfile inside ./docker/php with
Code:
FROM php:7.1-fpm
RUN docker-php-ext-install calendar && docker-php-ext-configure calendar
But I receive
Code:
ERROR: Cannot locate specified Dockerfile: Dockerfile