I am trying to set up a local installation of WordPress with PHP 8.2 to test a site with this PHP Version.
Therefore I used the docker-compose.yml
file from the wordpress developer site and replaced the wordpress:latest
image with wordpress:php8.2-fpm-alpine
.
Once I start the compose file with docker-compose up and try to open localhost:8080 I cannot access the site – I get the response "ERR_EMPTY_RESPONSE
". The log stays empty.
If I try to access my info.php file containing only the <?php phpinfo() ?>
command I also get ERR_EMPTY_RESPONSE
in the browser.
However if I change the image back to wordpress:latest
I can access the site and everything works as intended.
This is my complete docker-compose.yml file:
version: "3.6"
services:
wordpress:
image: wordpress:php8.2-fpm-alpine
container_name: wordpress
volumes:
- ./wordpress:/var/www/html
environment:
- WORDPRESS_DB_NAME=wordpress
- WORDPRESS_TABLE_PREFIX=wp_
- WORDPRESS_DB_HOST=db
- WORDPRESS_DB_USER=root
- WORDPRESS_DB_PASSWORD=password
depends_on:
- db
- phpmyadmin
restart: always
ports:
- 8080:80
db:
image: mariadb:latest
container_name: db
volumes:
- db_data:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=password
- MYSQL_USER=root
- MYSQL_PASSWORD=password
- MYSQL_DATABASE=wordpress
restart: always
phpmyadmin:
depends_on:
- db
image: phpmyadmin/phpmyadmin:latest
container_name: phpmyadmin
restart: always
ports:
- 8180:80
environment:
PMA_HOST: db
MYSQL_ROOT_PASSWORD: password
volumes:
db_data:
2
Answers
If you want to use identical system to
:latest
with just different php version, i would suggest usingwordpress:php8.2-apache
, not thefpm-alpine
as a base.The reason you get the error when using image
wordpress:php8.2-fpm-alpine
is that this image does not supply a Web server along with the PHP-fpm…. so there’s no actual webserver to translate php to web result..In turn, when you use image:
wordpress:latest
that has apache running alongside php-fpm, which then exposes a webserver that can rely information to the web browser onhttp://localhost:8080/
and show a webpage.