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.
This commit is contained in:
usmannasir
2026-03-07 04:53:52 +05:00
parent cc9d830507
commit 00d28b5a1c

View File

@@ -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