At the PHP Docker hub, there's 7.3-apache-stretch
and 7.3-fpm-stretch
, what's the difference? Which one is suited for a webapp?
Run the docker ps -a command to check if the container is running. Let us now discuss how you can set up the PHP-FPM and Nginx containers. We begin with getting a server that will act as the container to run the official Nginx image. We will create a docker-compose.yml to run our latest Nginx image. We will utilize ports 80 and 8080.
10 the apache image can be directly exposed, whereas the fpm image needs another web server that then connects to fpm to put it into perspective - the following docker-compose are almost identical (the second one requires a vhost to be added but I think you get the idea):
The recommended way to get the Bitnami PHP-FPM Docker Image is to pull the prebuilt image from the Docker Hub Registry. To use a specific version, you can pull a versioned tag. You can view the list of available versions in the Docker Hub Registry. If you wish, you can also build the image yourself.
php-fpm is the FastCGI server implementation of PHP which you would use with a FastCGI compliant web server such as Apache or Nginx. This variant contains PHP-FPM, which is a FastCGI implementation for PHP. See the PHP-FPM website for more information about PHP-FPM.
the apache image can be directly exposed, whereas the fpm image needs another web server that then connects to fpm
to put it into perspective - the following docker-compose are almost identical (the second one requires a vhost to be added but I think you get the idea):
php with apache:
services:
php:
image: php:7.3-apache-stretch
ports:
- 80
php with fpm (requires apache / nginx to work):
services:
php:
image: php:7.3-fpm-stretch
apache:
image: apache
ports:
- 80
links:
- php
as you can see the fpm version gives you more control - ie to use a different webserver
The 7.3-fpm-stretch
variant contains just PHP FPM, while 7.3-apache-stretch
contains also Apache httpd server and PHP configured as Apache module.
If you want to use PHP as Apache module, the apache variant may be suited for you.
If you want to use for example nginx or you just want to have FPM, you need the fpm variant.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With