PHP docker images based on official PHP repository, currently used by Bmeme for its development purposes, particularly suitable for Drupal or Symfony environments.
- PHP, of course
- Some useful executables like:
gnupg
git
patch
mysql-client
python3
vim
zip
- The following php extensions
bcmath
gd
intl
igbinary
mcrypt
only for 8.0 and olderoauth
opcache
pdo_mysql
pdo_pgsql
phpredis
sockets
only 8.0 and olderzip
- Composer
- Ansible (used in Bmeme for all automation tasks, @see here, for example)
8.3.12-apache-bookworm
,8.3-apache-bookworm
,latest
Dockerfile8.3.12-apache-bullseye
,8.3-apache-bullseye
, Dockerfile8.3.12-fpm-alpine
,8.3-fpm-alpine
, Dockerfile - EXPERIMENTAL8.2.24-apache-bookworm
,8.2-apache-bookworm
Dockerfile8.2.24-apache-bullseye
,8.2-apache-bullseye
Dockerfile8.2.24-fpm-alpine
,8.2-fpm-alpine
, Dockerfile - EXPERIMENTAL8.1.30-apache-bullseye
,8.1-apache-bullseye
Dockerfile8.1.30-fpm-alpine
,8.1-fpm-alpine
, Dockerfile - EXPERIMENTAL
8.1.14-apache-buster
,8.1-apache-buster
Dockerfile8.0.30-apache-bullseye
,8.0-apache-bullseye
Dockerfile8.0.30-apache-buster
,8.0-apache-buster
Dockerfile7.4.32-apache-bullseye
,7.4-apache-bullseye
, Dockerfile7.4.32-apache-buster
,7.4-apache-buster
, Dockerfile7.3.33-apache-buster
,7.3-apache-buster
, Dockerfile7.2.26-apache-buster
,7.2-apache-buster
, Dockerfile
Starting your PHP environment is really simple:
$ docker run --name myphpcontainer -p 8080:80 -d bmeme/php:latest
Obviously you can change the local binding port matching your needs.
FROM bmeme/php:latest
COPY src/ /var/www/html/
Where src/
is the directory containing all your PHP code.
Then, run the commands to build and run the Docker image:
$ docker build -t myphpimage:latest .
$ docker run -d --name myphpcontainer myphpimage:latest
$ docker run --name mydatabase -e ALLOW_EMPTY_PASSWORD=yes bitnami/mariadb:latest
$ docker run --name myapplication --link mydatabase -d bmeme/php:latest
Variable Name | Description | Default |
---|---|---|
COMPOSER_HOME |
home directory where composer will store packages and configuration. | /var/www/.composer |
TIMEZONE |
Image Timezone | Europe/Rome |
PHP_MEMORY_LIMIT |
memory_limit PHP value |
512M |
PHP_MAX_EXECUTION_TIME |
max_execution_time PHP value |
60 |
PHP_LOG_ENABLED |
log_errors PHP value. Boolean. |
1 |
PHP_ERROR_LOG |
error_log PHP value. |
/tmp/php_errors.log |
PHP_UPLOAD_MAX_FILESIZE |
upload_max_filesize PHP value. |
20M |
PHP_POST_MAX_SIZE |
post_max_size PHP value. |
20M |
PHP_SENDMAIL |
sendmail_path PHP value. |
/usr/local/sendmail |
Variable Name | Description | Default |
---|---|---|
OPCACHE_ENABLED |
opcache.enable PHP value |
1 |
OPCACHE_MEMORY_CONSUMPTION |
opcache.memory_consumption opcache config value |
128 |
OPCACHE_INTERNED_STRINGS_BUFFER |
opcache.interned_strings_buffer opcache config value |
8 |
OPCACHE_MAX_ACCELERATED_FILES |
opcache.max_accelerated_files opcache config value |
4000 |
OPCACHE_REVALIDATE_FREQ |
opcache.revalidate_freq opcache config value |
60 |
OPCACHE_FAST_SHUTDOWN |
opcache.fast_shutdown opcache config value |
1 |
For more infos about OpCache configuration @see https://www.php.net/manual/en/opcache.configuration.php
version: '3.1'
services:
php:
image: bmeme/php:latest
ports:
- 8080:80
environment: # just as example
- PHP_MEMORY_LIMIT=256M
- OPCACHE_ENABLED=0
mariadb:
image: bitnami/mariadb:latest
environment:
- ALLOW_EMPTY_PASSWORD: yes
- MARIADB_DATABASE: mydatabase
- MARIADB_USER: myuser
- MARIADB_PASSWORD: secret
This project is a contribution of Bmeme :: The Digital Factory. This library is actually maintained by Daniele Piaggesi and Roberto Mariani. Any other contribution will be really appreciated.