diff --git a/Dockerfile b/Dockerfile index e8df303..84e465e 100644 --- a/Dockerfile +++ b/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 diff --git a/assets/bin/RunTrackmaniaServer.sh b/assets/bin/RunTrackmaniaServer.sh index 7420e53..f9fcc30 100644 --- a/assets/bin/RunTrackmaniaServer.sh +++ b/assets/bin/RunTrackmaniaServer.sh @@ -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" < PHP-Debug-Modus deaktiviert" + cat > "$PHP_INI_DIR/99-adminserv-debug.ini" < **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