skip to Main Content

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


  1. If you want to use identical system to :latest with just different php version, i would suggest using wordpress:php8.2-apache, not the fpm-alpine as a base.

    Login or Signup to reply.
  2. 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..

    $ docker exec -it wordpress bash
    87d4819c5301:/var/www/html# netstat -tanp
    Active Internet connections (servers and established)
    Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
    tcp        0      0 127.0.0.11:42163        0.0.0.0:*               LISTEN      -
    tcp        0      0 :::9000                 :::*                    LISTEN      1/php-fpm.conf)
    87d4819c5301:/var/www/html# 
    87d4819c5301:/var/www/html# ps auxf
    PID   USER     TIME  COMMAND
        1 root      0:00 php-fpm: master process (/usr/local/etc/php-fpm.conf)
        9 www-data  0:00 php-fpm: pool www
       10 www-data  0:00 php-fpm: pool www
       11 root      0:00 bash
       18 root      0:00 ps auxf
    

    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 on http://localhost:8080/ and show a webpage.

    root@6215e955f5f4:/var/www/html# ps aufx
    USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
    root          24  0.1  0.0   4164  3244 pts/0    Ss   18:27   0:00 bash
    root          33  0.0  0.0   6760  2752 pts/0    R+   18:28   0:00  _ ps aufx
    root           1  0.1  0.2 233340 35484 ?        Ss   18:27   0:00 apache2 -DFOREGROUND
    www-data      19  0.0  0.0 233412  9164 ?        S    18:27   0:00 apache2 -DFOREGROUND
    www-data      20  0.0  0.0 233412  9164 ?        S    18:27   0:00 apache2 -DFOREGROUND
    www-data      21  0.0  0.0 233412  9164 ?        S    18:27   0:00 apache2 -DFOREGROUND
    www-data      22  0.0  0.0 233412  9164 ?        S    18:27   0:00 apache2 -DFOREGROUND
    www-data      23  0.0  0.0 233412  9164 ?        S    18:27   0:00 apache2 -DFOREGROUND
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search