PHP debug.
This commit is contained in:
17
Dockerfile
17
Dockerfile
@@ -11,6 +11,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
php \
|
||||
php-zip \
|
||||
php-xml \
|
||||
php-mbstring \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY assets/bin/TrackmaniaServer_2011-02-21.zip /opt/tmserver
|
||||
@@ -32,7 +33,18 @@ COPY assets/bin/AdminServ_v2.1.1.zip /var/www/html
|
||||
RUN unzip /var/www/html/AdminServ_v2.1.1.zip -d /var/www/html \
|
||||
&& rm -f /var/www/html/AdminServ_v2.1.1.zip \
|
||||
&& chmod -R 777 /var/www/html/ \
|
||||
&& rm -f /var/www/html/index.html
|
||||
&& rm -f /var/www/html/index.html \
|
||||
&& mkdir -p /var/www/html/logs \
|
||||
&& chmod 777 /var/www/html/logs
|
||||
|
||||
# PHP 8 Kompatibilitaets-Patches fuer AdminServ
|
||||
# stristr() akzeptiert seit PHP 8 keine Arrays mehr – is_string()-Check hinzufuegen
|
||||
RUN sed -i \
|
||||
's|if(stristr($value, "../"))|if(is_string($value) \&\& stristr($value, "../"))|g' \
|
||||
/var/www/html/index.php
|
||||
|
||||
# PHP-Debug-Konfiguration: wird zur Laufzeit vom Startup-Script gesetzt
|
||||
# (kein Rebuild noetig – nur Container neustarten)
|
||||
|
||||
# --- Umgebungsvariablen ---
|
||||
# Sensible Werte (Passwoerter, Keys) werden NICHT im Image hinterlegt,
|
||||
@@ -57,6 +69,9 @@ ENV SERVER_DOWNLOAD_RATE=8192
|
||||
ENV SERVER_MODE=internet
|
||||
ENV FORCE_CONFIG_UPDATE=false
|
||||
|
||||
# Debugging
|
||||
ENV PHP_DISPLAY_ERRORS=false
|
||||
|
||||
# Volume fuer persistente GameData (Config, Tracks, Skins, Scores, etc.)
|
||||
VOLUME /opt/tmserver/GameData
|
||||
|
||||
|
||||
@@ -1,5 +1,29 @@
|
||||
#!/bin/sh
|
||||
|
||||
# ============================================================
|
||||
# PHP-Debug-Modus konfigurieren (per Umgebungsvariable)
|
||||
# ============================================================
|
||||
PHP_DISPLAY_ERRORS="${PHP_DISPLAY_ERRORS:-false}"
|
||||
PHP_INI_DIR=$(find /etc/php -type d -name "conf.d" -path "*/apache2/*" | head -1)
|
||||
|
||||
if [ "$PHP_DISPLAY_ERRORS" = "true" ]; then
|
||||
echo "==> PHP-Debug-Modus AKTIVIERT (PHP_DISPLAY_ERRORS=true)"
|
||||
cat > "$PHP_INI_DIR/99-adminserv-debug.ini" <<EOF
|
||||
display_errors = On
|
||||
error_reporting = E_ALL
|
||||
log_errors = On
|
||||
error_log = /var/log/php_errors.log
|
||||
EOF
|
||||
else
|
||||
echo "==> PHP-Debug-Modus deaktiviert"
|
||||
cat > "$PHP_INI_DIR/99-adminserv-debug.ini" <<EOF
|
||||
display_errors = Off
|
||||
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
|
||||
log_errors = On
|
||||
error_log = /var/log/php_errors.log
|
||||
EOF
|
||||
fi
|
||||
|
||||
echo "Starting apache server"
|
||||
service apache2 start
|
||||
|
||||
|
||||
@@ -64,6 +64,14 @@ nano .env
|
||||
| `SERVER_MODE` | Server-Modus (`internet` oder `lan`) | `internet` |
|
||||
| `FORCE_CONFIG_UPDATE` | Erzwingt erneutes Anwenden aller Umgebungsvariablen auf die Config | `false` |
|
||||
|
||||
## Debugging
|
||||
|
||||
| Variable | Beschreibung | Standard |
|
||||
|----------|-------------|----------|
|
||||
| `PHP_DISPLAY_ERRORS` | Zeigt PHP-Fehlermeldungen im Browser an (nur zur Fehlersuche!) | `false` |
|
||||
|
||||
> **Hinweis:** Der Debug-Modus erfordert **keinen** Rebuild des Images. Es genügt, die Variable in der `.env`-Datei zu ändern und den Container neu zu starten (`docker compose restart`). Im Produktivbetrieb sollte `PHP_DISPLAY_ERRORS` immer auf `false` stehen.
|
||||
|
||||
> **Hinweis:** Bei `FORCE_CONFIG_UPDATE=true` wird die `dedicated_cfg.txt` aus dem Template neu erzeugt und alle Platzhalter mit den aktuellen Umgebungsvariablen ersetzt. Manuelle Änderungen gehen dabei verloren! Nach dem Update sollte `FORCE_CONFIG_UPDATE` wieder auf `false` gesetzt werden.
|
||||
|
||||
## Beispiel
|
||||
|
||||
Reference in New Issue
Block a user