0

I am using docker for my yii1 application. And everything works. But after I login on my application. I get this error:

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at [no address given] to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

Apache/2.4.53 (Debian) Server at localhost Port 8082

So this is my docker-compose fyle:

version: '3'
services:
  web:
    image: nguyenmanhluu/yii1:1.0
    container_name: dockeryiidisc
    ports:
      - "8082:80"
    build: 
      context: ..
      dockerfile: Dockerfile
      target: dev     
    volumes:
      - ./:/var/www/html       
    command: /bin/sh -c "service apache2 start && while sleep 1000; do :; done"
   
  db:
    container_name: dockeryiimysql
    image: mysql:latest
    volumes:
      - dockeryiimysql:/var/lib/mysql
    ports:
      - "3306:3306"
    environment:
      MYSQL_ALLOW_EMPTY_PASSWORD: 'true'
      MYSQL_DATABASE: sdi      

  phpmyadmin:  
    container_name: dockeryiipma
    image: phpmyadmin:latest
    environment:
      UPLOAD_LIMIT: 300M
      PMA_ARBITRARY: 1
      APACHE_HTTP_PORT_NUMBER: 8080
    ports:
      - 8080:8080
    command: /bin/bash -c "sed -i \"s/80/$$APACHE_HTTP_PORT_NUMBER/g\" /etc/apache2/sites-available/000-default.conf /etc/apache2/ports.conf && /docker-entrypoint.sh apache2-foreground"

volumes:
  dockeryiimysql: {}

and my file 000-default.conf

<VirtualHost *:80>
    DocumentRoot /var/www/public

    <Directory /var/www>
            AllowOverride all
            Require all granted
    </Directory>
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

and my docker file:

FROM php:8.1-apache as dev

ENV DEBIAN_FRONTEND=noninteractive
ENV APP_ENV=development

WORKDIR /var/www/html

RUN apt-get update \
  && apt-get -y install --no-install-recommends apt-utils zip unzip nano ncdu 2>&1 \
    && apt-get -y install --no-install-recommends python graphviz 2>&1 \
  && apt-get -y install git iproute2 procps lsb-release \
  && apt-get install -y -qq software-properties-common \
  && apt-get install -y -qq wget git lynx ack-grep \
  && yes | pecl install xdebug \
  && echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini \
    && apt-get -y install libicu-dev \
    && docker-php-ext-install intl pdo_mysql opcache \
    && pecl install apcu && docker-php-ext-enable apcu \
    && echo "apc.enable_cli=1" > /usr/local/etc/php/php.ini \
    && echo "apc.enable=1" > /usr/local/etc/php/php.ini \
  && echo "post_max_size = 100M" > /usr/local/etc/php/php.ini \
    && a2enmod rewrite \
  && apt-get autoremove -y \
  && apt-get clean -y \
  && rm -rf /var/lib/apt/lists/*

RUN apt-get update && apt-get install gnupg2 -y

RUN rm -rf /etc/apache2/sites-enabled \
    && ln -s /var/www/html/.devcontainer/sites-enabled /etc/apache2/sites-enabled

RUN echo 'alias ll="ls -la --color=auto"' >> ~/.bashrc && \
    echo "alias ack='ack-grep'" >> ~/.bashrc

RUN chown www-data:www-data -R ./

ENV DEBIAN_FRONTEND=dialog

my question is: what I have to change?

Where can I access the log files?

I have this:

CONTAINER ID   IMAGE                    COMMAND                  CREATED          STATUS          PORTS                               NAMES
06276923b58b   mysql:latest             "docker-entrypoint.s…"   15 minutes ago   Up 15 minutes   0.0.0.0:3306->3306/tcp, 33060/tcp   dockeryiimysql
81055c285fdc   nguyenmanhluu/yii1:1.0   "docker-php-entrypoi…"   15 minutes ago   Up 15 minutes   0.0.0.0:8083->80/tcp                dockeryiidisc
eb7bd150d254   phpmyadmin:latest        "/docker-entrypoint.…"   15 minutes ago   Up 15 minutes   80/tcp, 0.0.0.0:8080->8080/tcp      dockeryiipma
PS C:\xampp\htdocs\webScraper> docker exec -it 81055c285fdc bash
root@81055c285fdc:/var/www/html#

And I used the correct host in the file main.php for container name:

'db'=> [
            'pdoClass' => 'NestedPDO',
            'connectionString' => 'mysql:host=dockeryiimysql;dbname=sdi',
            'emulatePrepare' => true,
            'username' => 'root',
            'password' => '',
            'charset' => 'utf8',
            'enableProfiling'=>true,
        ],

on the phpmyadmin container I found this:

AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.21.0.3. Set the 'ServerName' directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.21.0.3. Set the 'ServerName' directive globally to suppress this message
[Mon May 23 07:06:13.275555 2022] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.53 (Debian) PHP/8.0.19 configured -- resuming normal operations
[Mon May 23 07:06:13.275613 2022] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
172.21.0.1 - - [23/May/2022:07:06:36 +0000] "GET /index.php?route=/&route=%2F HTTP/1.1" 200 6290 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36 OPR/86.0.4363.59"
172.21.0.1 - - [23/May/2022:07:06:40 +0000] "POST /index.php?route=/ HTTP/1.1" 302 1020 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36 OPR/86.0.4363.59"
172.21.0.1 - - [23/May/2022:07:06:40 +0000] "GET /index.php?route=/&route=%2F HTTP/1.1" 200 18402 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36 OPR/86.0.4363.59"
172.21.0.1 - - [23/May/2022:07:06:40 +0000] "POST /index.php?route=/config/get HTTP/1.1" 200 2471 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36 OPR/86.0.4363.59"
172.21.0.1 - - [23/May/2022:07:06:40 +0000] "POST /index.php?route=/navigation&ajax_request=1 HTTP/1.1" 200 3205 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36 OPR/86.0.4363.59"
172.21.0.1 - - [23/May/2022:07:06:40 +0000] "POST /index.php?route=/version-check HTTP/1.1" 200 1047 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36 OPR/86.0.4363.59"
172.21.0.1 - - [23/May/2022:07:06:40 +0000] "POST /index.php?route=/config/get HTTP/1.1" 200 2573 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36 OPR/86.0.4363.59"
172.21.0.1 - - [23/May/2022:07:06:40 +0000] "POST /index.php?route=/config/set HTTP/1.1" 200 2462 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36 OPR/86.0.4363.59"
172.21.0.1 - - [23/May/2022:07:06:42 +0000] "POST /index.php?route=/navigation&ajax_request=1 HTTP/1.1" 200 3897 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36 OPR/86.0.4363.59"
172.21.0.1 - - [23/May/2022:07:30:35 +0000] "POST /index.php?route=/ HTTP/1.1" 200 2458 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36 OPR/86.0.4363.59"
172.21.0.1 - - [23/May/2022:07:49:14 +0000] "POST /index.php?route=/ HTTP/1.1" 200 2466 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36 OPR/86.0.4363.59"
172.21.0.1 - - [23/May/2022:08:14:59 +0000] "POST /index.php?route=/ HTTP/1.1" 200 3027 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36 OPR/86.0.4363.59"
172.21.0.1 - - [23/May/2022:08:14:59 +0000] "GET /themes/pmahomme/img/s_error.png HTTP/1.1" 200 898 "http://localhost:8080/themes/pmahomme/css/theme.css?v=5.2.0" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36 OPR/86.0.4363.59"
5
  • "More information about this error may be available in the server error log" ...did you have a look?
    – ADyson
    May 22, 2022 at 19:43
  • Where can I find the error log files? May 22, 2022 at 20:01
  • Actually it looks like docker and the server are running in general. The fault is probably in your php-code which you didn't post.
    – David
    May 22, 2022 at 20:01
  • but local the application is running fine. No errors. And oke. Which php file I have to shown here? I can't of course show all the files. May 22, 2022 at 20:06
  • "Where can I find the error log files?" ...it depends on your Apache and PHP configuration. There are defaults for each of those two components though, which may differ slightly depending on the O/S you've installed it on - it should be possible to search online / read documentation to check. Alternatively, check the configuration files for PHP and Apache in your environment to see where they're currently set to log errors too. Since it's unclear at this point if the error originated from PHP or Apache, you may need to check both sets of logs.
    – ADyson
    May 22, 2022 at 20:13

1 Answer 1

1

You need to use docker exec command to get shell access into your web (dockeryiidisc) container where apache is running. Once you are in that shell, you can look for apache log files. By default, you can find the Apache access log file at the following path: /var/log/apache/access.log

Shell access command would be:

docker exec -it -u 0 dockeryiidisc bash

This basically ties your command prompt into the container named dockeriidisc (your apache container as per your compose yaml file)

-u 0 gives you root access of the container.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.