ubuntuusers.de

Docker (Debian Apache2 PHP7)

Status: Gelöst | Ubuntu-Version: Nicht spezifiziert
Antworten |

bloody_noob

Anmeldungsdatum:
4. Oktober 2007

Beiträge: 123

Moin alle zusammen,

Ich schaue mir gerade Docker an und möchte in einem Debian Stretch Image Apache2 und PHP 7.0 bereitstellen, das klappt soweit auch ganz gut aber irgendwie haut PHP nicht wirklich hin.

Wie es aussieht wird keine Apache2 Konfiguration für PHP erstellt (php.ini) und ich frage mich was ich übersehe: Dockerfile:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
CodeFROM debian:stretch
SHELL ["/bin/bash", "-c"]
ENV DEBIAN_FRONTEND noninteractive

ADD ./phpinfo.php /var/www/html/

RUN apt-get update && apt-get upgrade -y && apt-get install -y apt-utils && apt-get install -y --no-install-recommends \
  acl nano whois pwgen apache2 apache2-utils \
  php php-pgsql php-imap php-curl php-cgi php-xml \
  libyaml-perl libdbd-pg-perl libdbi-perl

ENTRYPOINT ["apachectl", "-DFOREGROUND"]

docker-compose.yml:

1
2
3
4
5
6
Codeversion: '3'
services:
  webphp:
    build: .
    ports:
     - "8080:80"

Ich erhalte eine Leere Seite, wenn ich phpinfo.php aufrufen möchte, ich bin mir nicht sicher ob mir noch ein Paket fehlt und wenn ja welches. Vielleicht habt ihr ja einen Anhaltspunkt für einen Docker-Neuling.

misterunknown Team-Icon

Ehemalige
Avatar von misterunknown

Anmeldungsdatum:
28. Oktober 2009

Beiträge: 4403

Wohnort: Sachsen

Hast du auch das Apache-Modul für PHP installiert? Was sagt das Log?

bloody_noob

(Themenstarter)

Anmeldungsdatum:
4. Oktober 2007

Beiträge: 123

Moin,

Mir fehlte definitiv libapache2-mod-php, das habe ich nun installiert und geprüft ob es aktiviert ist:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
root@cf7492cef58e:/# a2enmod php7.0
Considering dependency mpm_prefork for php7.0:
Considering conflict mpm_event for mpm_prefork:
Considering conflict mpm_worker for mpm_prefork:
Module mpm_prefork already enabled
Considering conflict php5 for php7.0:
Module php7.0 already enabled

root@cf7492cef58e:/# a2enconf php*     
Enabling conf php7.0-cgi.
To activate the new configuration, you need to run:
  service apache2 reload
root@cf7492cef58e:/#   service apache2 reload
[ ok ] Reloading Apache httpd web server: apache2.

Die Apache Logs geben leider nichts her (Errorlog: debug):

1
2
3
4
5
[Mon Feb 18 14:04:05.168821 2019] [authz_core:debug] [pid 11] mod_authz_core.c(809): [client 172.20.0.1:56786] AH01626: authorization result of Require all granted: granted
[Mon Feb 18 14:04:05.168959 2019] [authz_core:debug] [pid 11] mod_authz_core.c(809): [client 172.20.0.1:56786] AH01626: authorization result of <RequireAny>: granted
[Mon Feb 18 14:04:05.205493 2019] [authz_core:debug] [pid 11] mod_authz_core.c(809): [client 172.20.0.1:56786] AH01626: authorization result of Require all granted: granted
[Mon Feb 18 14:04:05.205521 2019] [authz_core:debug] [pid 11] mod_authz_core.c(809): [client 172.20.0.1:56786] AH01626: authorization result of <RequireAny>: granted
[Mon Feb 18 14:04:05.205546 2019] [core:info] [pid 11] [client 172.20.0.1:56786] AH00128: File does not exist: /var/www/html/favicon.ico

bloody_noob

(Themenstarter)

Anmeldungsdatum:
4. Oktober 2007

Beiträge: 123

Es war das fehlende Apache Modul und ein Typo in meinem Testscript. Es läuft!

Antworten |