Docker image tailored to run PHP application. Check https://hub.docker.com/r/touch4it/docker-php7
This repository is a source code for following Docker images that allow relatively easily work with PHP frameworks. Included images:
PHP 7
- Debian + Apache + mod_php
- touch4it/docker-php7:php7.3-apache
- touch4it/docker-php7:php7.4-apache
- Debian + Apache + PHP-FPM
- touch4it/docker-php7:php7.3-fpm-apache
- touch4it/docker-php7:php7.4-fpm-apache
- Alpine + Nginx + PHP-FPM
- touch4it/docker-php7:php7.3-fpm-nginx
- touch4it/docker-php7:php7.3-fpm-nginx-dev
- touch4it/docker-php7:php7.4-fpm-nginx
- touch4it/docker-php7:php7.4-fpm-nginx-dev
PHP 8
- Debian + Apache + mod_php
- touch4it/php8:php8.1-apache
- touch4it/php8:php8.2-apache
- touch4it/php8:php8.3-apache
- Debian + Apache + PHP-FPM
- touch4it/php8:php8.1-fpm-apache
- touch4it/php8:php8.2-fpm-apache
- touch4it/php8:php8.3-fpm-apache
- Alpine + Nginx + PHP-FPM
- touch4it/php8:latest
- touch4it/php8:php8.1-fpm-nginx
- touch4it/php8:php8.2-fpm-nginx
- touch4it/php8:php8.3-fpm-nginx
- touch4it/php8:php8.1-fpm-nginx-dev
- touch4it/php8:php8.2-fpm-nginx-dev
- touch4it/php8:php8.3-fpm-nginx-dev
Frameworks
- Symfony
- touch4it/php7-apache-symfony:php7.3
- touch4it/php7-apache-symfony:php7.4
- touch4it/php-nginx-symfony:php7.3-fpm-nginx
- touch4it/php-nginx-symfony:php7.3-fpm-nginx-dev
- touch4it/php-nginx-symfony:latest, php7.4-fpm-nginx
- touch4it/php-nginx-symfony:php7.4-fpm-nginx-dev
- Drupal
- touch4it/drupal-php-fpm-nginx:latest, 10.0.11, 10.0
- touch4it/drupal-php-fpm-nginx:9.5.11, 9.5
- Drupal console
- touch4it/drupal-php-fpm-nginx:console
- Symfony
- touch4it/php7-apache-symfony:php7.3
- touch4it/php7-apache-symfony:php7.4
- touch4it/php-nginx-symfony:php7.3-fpm-nginx
- touch4it/php-nginx-symfony:php7.3-fpm-nginx-dev
- touch4it/php-nginx-symfony:latest, php7.4-fpm-nginx
- touch4it/php-nginx-symfony:php7.4-fpm-nginx-dev
You can you this docker-compose.yml file to develop:
www:
image: touch4it/docker-php7:latest
volumes:
- ".:/var/www/html"
ports:
- "80"
Of course, you are free to add linked containers like database, caching etc.
Use docker-compose up
command to start your development environment.
You can build production ready image with Dockerfile like this:
FROM touch4it/docker-php7:latest
ADD . /var/www/html
This image uses several environment variables which are easy to miss. While none of the variables are required, they may significantly aid you in using the image.
The ServerAdmin sets the contact address that the server includes in any error messages it returns to the client.
If the httpd doesn't recognize the supplied argument as an URL, it assumes, that it's an email-address and prepends it with mailto:
in hyperlink targets.
However, it's recommended to actually use an email address, since there are a lot of CGI scripts that make that assumption.
If you want to use an URL, it should point to another server under your control. Otherwise users may not be able to contact you in case of errors.
Default value: webmaster@localhost
For Apache-based images
Defines the default timezone used by the date functions
Default value: Europe/London
Maximum amount of memory a script may consume
Default value: 256M
Maximum allowed size for uploaded files.
http://php.net/upload-max-filesize
Default value: 32M
Maximum size of POST data that PHP will accept. Its value may be 0 to disable the limit. It is ignored if POST data reading is disabled through enable_post_data_reading.
Default value: 32M
- mod_rewrite
For Apache-based images
- mod_http2
for Apache 2.4.26+ based images
- bcmath
- exif
- gd
- gettext
- intl
- mbstring
- opcache
- pgsql
- pdo
- pdo_mysql
- pdo_pgsql
- zip
This work is based on official Docker Hub php
images. You can use docker-php-ext-install to add new extensions. More information can be found https://hub.docker.com/_/php/
You can add an ini file into $PHP_INI_DIR/conf.d
directory
Check if you have not selected Nginx-based image
Same as in similar official PHP image on Docker Hub
1.22