Docker Community Forums

Share and learn in the Docker community.

Status code 500 wordpress

docker

(Rakma) #1

Im new to docker and i have encountered a problem where i wanna setup WordPress but in step 2 of the setup the websites dies and gives me.

php_1         | 172.29.0.3 -  15/Aug/2017:14:15:03 +0000 "GET /wp-admin/setup-config.php" 500                     
php_1         | 172.29.0.3 -  15/Aug/2017:14:15:04 +0000 "GET /wp-admin/setup-config.php" 500

I can access PHPMyAdmin without problems and everything runs like it should. I´m on a Linux machine.

docker-compose.yml

version: "3"

services:
  nginx:
    build: ./nginx/
    ports:
      - "80:80"
    volumes:
      - "${PROJECT_ROOT}:/var/www/public:ro"
      - ./nginx/logs:/var/log/nginx
    networks:
      - server
    depends_on:
      - php
    restart: always

  php:
    build: ./php/
    expose:
      - 9000
    volumes:
      - "${PROJECT_ROOT}:/var/www/public"
    networks:
      - database
      - server
    depends_on:
      - mysql


  mysql:
    image: mariadb
    ports:
      - '3306:3306'
    volumes:
      - ./mysql/db-data:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=${DB_ROOT_PASSWORD}
    restart: always
    networks:
      - database

  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    ports:
      - 8080:80
    networks:
      - database
    depends_on:
      - mysql
    environment:
      PMA_HOST: mysql
    restart: always

  composer:
    restart: 'no'
    image: composer/composer:php7
    command: install
    volumes:
      - "${PROJECT_UROOT}:/var/www"
    working_dir: ${PROJECT_SROOT}

volumes:
    data:

networks:
    database:
    server:

nginx/default.conf

server {
        listen 80 default_server;
        root /var/www/public/;
        index index.html index.php;
        charset utf-8;

        location / {
            try_files $uri $uri/ /index.php?$query_string;
        }

        location = /favicon.ico { access_log off; log_not_found off; }
        location = /robots.txt  { access_log off; log_not_found off; }

        access_log off;
        error_log  /var/log/nginx/error.log error;

        sendfile off;

        client_max_body_size 100m;

        location ~ \.php$ {
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass php:9000;
            fastcgi_index index.php;
            include fastcgi_params;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            fastcgi_intercept_errors off;
            fastcgi_buffer_size 16k;
            fastcgi_buffers 4 16k;
        }

        location ~ /\.ht {
            deny all;
        }
        
    }

nginx/dockerfile

FROM nginx:latest
COPY ./default.conf /etc/nginx/conf.d/default.conf

php/dockerfile/

FROM php:7.0-fpm
RUN docker-php-ext-install pdo_mysql 

.env

PROJECT_ROOT=./www/public
PROJECT_UROOT=./www
PROJECT_SROOT=/var/www
DB_ROOT_PASSWORD=test123

(Rakma) #2

fixed the problem by adding this ext

mysqli pdo

to the php dockerfile


#3

Hi,

I’ve encountered the same issue, but I’m unsure how you add mysqli pdo to the Dockerfile?

Would you be able to post your new Dockerfile contents?

Kind regards,