From 00d28b5a1cc935383e8623b08cfc0261bd9119c0 Mon Sep 17 00:00:00 2001 From: usmannasir Date: Sat, 7 Mar 2026 04:53:52 +0500 Subject: [PATCH] Fix broken PHP symlink after upgrade: use lexists to detect dangling symlinks os.path.exists() returns False for broken symlinks (e.g. /usr/bin/php pointing to removed php7.4), so the old link was never removed and the new ln -s to lsphp83 failed silently. Use os.path.lexists() instead. --- plogical/upgrade.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plogical/upgrade.py b/plogical/upgrade.py index c62dae39e..e679f3f81 100644 --- a/plogical/upgrade.py +++ b/plogical/upgrade.py @@ -4846,8 +4846,8 @@ pm.max_spare_servers = 3 Upgrade.stdOut('[ERROR] Failed to install PHP 8.3') return 0 - # Remove existing PHP symlink if it exists - if os.path.exists('/usr/bin/php'): + # Remove existing PHP symlink if it exists (os.path.lexists catches broken symlinks too) + if os.path.lexists('/usr/bin/php'): os.remove('/usr/bin/php') # Create symlink to PHP 8.3