From 25ea8c7353dfb835f14e816431e35cb8fce5c674 Mon Sep 17 00:00:00 2001 From: Lutz Bender Date: Mon, 26 Oct 2026 09:10:23 +0100 Subject: [PATCH 1/3] upgrade to custom php version --- runs/install_packages.sh | 59 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/runs/install_packages.sh b/runs/install_packages.sh index f16ed31182..1a072d62a2 100755 --- a/runs/install_packages.sh +++ b/runs/install_packages.sh @@ -23,3 +23,62 @@ sudo apt-get -q -y install \ xserver-xorg x11-xserver-utils openbox-lxde-session lightdm lightdm-autologin-greeter accountsservice \ chromium chromium-l10n echo "done" + +# Apply the PHP 7.4 package fix for php2shell on supported Debian 11 platforms. +. /etc/os-release +php74_fix_url="" +if [ "${VERSION_ID:-}" = "11" ] && [ "$(dpkg --print-architecture)" = "armhf" ] && [ "${ID:-}" = "raspbian" ]; then + php74_fix_url="https://openwb.de/update/openwb-php74-fix-r2-raspbian11-armhf.tar.xz" +elif [ "${VERSION_ID:-}" = "11" ] && [ "$(dpkg --print-architecture)" = "amd64" ] && [ "${ID:-}" = "debian" ]; then + php74_fix_url="https://openwb.de/update/openwb-php74-fix-r2-debian11-amd64.tar.xz" +fi + +php74_fix_needed=$(dpkg-query -W -f='${db:Status-Status} ${Version}\n' \ + php7.4-cli php7.4-common libapache2-mod-php7.4 2>/dev/null | + awk '$1 == "installed" && index($2, "+owphp2shell1") == 0 { needed = 1 } END { print needed + 0 }') + +if [ -n "$php74_fix_url" ] && [ "$php74_fix_needed" -eq 1 ]; then + ( + set -e + workdir=$(mktemp -d "$HOME/php-fix-r2.XXXXXX") + apache_stopped=0 + restart_apache() { + if [ "$apache_stopped" -eq 1 ]; then + sudo systemctl start apache2 || true + fi + } + cleanup() { + restart_apache + rm -rf "$workdir" + } + trap cleanup EXIT + + echo "Applying PHP 7.4 package fix..." + curl -fL -o "$workdir/php74-fix.tar.xz" "$php74_fix_url" + tar -xf "$workdir/php74-fix.tar.xz" -C "$workdir" + package_dir=$(find "$workdir" -mindepth 1 -maxdepth 2 -type f -name SHA256SUMS -printf '%h\n' -quit) + if [ -z "$package_dir" ] || [ ! -d "$package_dir/pakete" ]; then + echo "PHP 7.4 package archive has an unexpected structure." >&2 + exit 1 + fi + cd "$package_dir" + sha256sum -c SHA256SUMS + sudo apt-get --simulate --no-remove install -y ./pakete/*.deb + apache_stopped=1 + sudo systemctl stop apache2 + sudo apt-get --no-remove install -y ./pakete/*.deb + sudo apache2ctl configtest + sudo systemctl start apache2 + apache_stopped=0 + dpkg-query -W php7.4-cli php7.4-common libapache2-mod-php7.4 + status=$(sudo systemctl is-active "apache2" || true) + printf 'apache2: %s\n' "$status" + ) || { + echo "PHP 7.4 package fix failed." >&2 + exit 1 + } +elif [ -n "$php74_fix_url" ] && [ "$php74_fix_needed" -eq 0 ]; then + echo "PHP 7.4 package fix for php2shell is already applied." +elif [ -z "$php74_fix_url" ]; then + echo "PHP 7.4 package fix for php2shell is not supported on this platform." +fi From b51270a48398ee15e332593268c5f61366913600 Mon Sep 17 00:00:00 2001 From: Lutz Bender Date: Mon, 26 Oct 2026 10:17:39 +0100 Subject: [PATCH 2/3] fix error handling --- runs/install_packages.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/runs/install_packages.sh b/runs/install_packages.sh index 1a072d62a2..73f5ecb4d6 100755 --- a/runs/install_packages.sh +++ b/runs/install_packages.sh @@ -73,10 +73,12 @@ if [ -n "$php74_fix_url" ] && [ "$php74_fix_needed" -eq 1 ]; then dpkg-query -W php7.4-cli php7.4-common libapache2-mod-php7.4 status=$(sudo systemctl is-active "apache2" || true) printf 'apache2: %s\n' "$status" - ) || { + ) + php74_fix_status=$? + if [ "$php74_fix_status" -ne 0 ]; then echo "PHP 7.4 package fix failed." >&2 - exit 1 - } + exit "$php74_fix_status" + fi elif [ -n "$php74_fix_url" ] && [ "$php74_fix_needed" -eq 0 ]; then echo "PHP 7.4 package fix for php2shell is already applied." elif [ -z "$php74_fix_url" ]; then From 69ee3ad07305a2e058166c55870e4dcb269d35c2 Mon Sep 17 00:00:00 2001 From: Lutz Bender Date: Mon, 26 Oct 2026 11:17:14 +0100 Subject: [PATCH 3/3] add php version to software info --- web/maintenance/systeminfo.html | 16 ++++++++++------ web/maintenance/systeminfo_api.php | 14 ++++++++++++++ 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/web/maintenance/systeminfo.html b/web/maintenance/systeminfo.html index 77ddd1f258..bfd711b8a3 100644 --- a/web/maintenance/systeminfo.html +++ b/web/maintenance/systeminfo.html @@ -1,4 +1,4 @@ - + @@ -101,12 +101,16 @@

Details

for (const subKey in value) { if (Object.hasOwn(value, subKey)) { const v = value[subKey]; - html += `${subKey}`; + const label = + key === "softwareInfo" && subKey === "php_version" + ? "PHP-Version" + : subKey; + html += `${label}`; // Falls "details" vorhanden, einen runden Info-Button anzeigen if (v && typeof v === "object" && "details" in v) { const infoBtnId = `info_${key}_${subKey}`.replace( /\W/g, - "_" + "_", ); html += ` `; } @@ -171,7 +175,7 @@

Details

}, 2000); alert( "Fehler beim Neustart: " + - (result.message || result.output || "") + (result.message || result.output || ""), ); } } catch (err) { @@ -291,7 +295,7 @@

${key}

const data = value.map((e) => typeof e.v === "object" && e.v !== null && "value" in e.v ? Number(e.v.value) - : Number(e.v) + : Number(e.v), ); // Einheit für Achsenlabel holen let unit = ""; @@ -347,7 +351,7 @@

${key}

const data = arr.map((e) => typeof e.v === "object" && e.v !== null && "value" in e.v ? Number(e.v.value) - : Number(e.v) + : Number(e.v), ); const chartKey = `${key}_${subKey}`; // Einheit für Achsenlabel holen diff --git a/web/maintenance/systeminfo_api.php b/web/maintenance/systeminfo_api.php index 5c1183bb97..2afca31be8 100644 --- a/web/maintenance/systeminfo_api.php +++ b/web/maintenance/systeminfo_api.php @@ -154,6 +154,16 @@ function getSoftwareInfo() $version = 'unbekannt'; // $branch = 'unbekannt'; $commit = 'unbekannt'; + $phpVersion = 'unbekannt'; + $phpPackage = 'php' . PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION . '-cli'; + $phpPackageInfo = trim((string)@shell_exec( + "dpkg-query -W -f='\${db:Status-Status}|\${Version}' " . + escapeshellarg($phpPackage) . + " 2>/dev/null" + )); + if (strpos($phpPackageInfo, 'installed|') === 0) { + $phpVersion = substr($phpPackageInfo, strlen('installed|')); + } // Git-Verzeichnis bestimmen (eine Ebene höher als "web") $repoDir = dirname(__DIR__, 2); @@ -189,6 +199,10 @@ function getSoftwareInfo() 'git_commit' => [ 'value' => $commit, 'unit' => '' + ], + 'php_version' => [ + 'value' => $phpVersion, + 'unit' => '' ] ]; }