Update PHP version handling and installation logic across scripts

- Adjusted PHP version priority in cyberpanel_upgrade.sh and install.py to include PHP 8.5 (beta) as the highest priority.
- Enhanced package installation logic in cyberpanel.sh and installCyberPanel.py to install PHP dependencies more robustly, including error handling for missing packages.
- Updated README.md to reflect the new recommended PHP versions and deprecated versions.
- Improved error handling and dependency management in phpUtilities.py and upgrade.py for better installation reliability.
This commit is contained in:
Master3395
2025-09-24 01:11:23 +02:00
parent 93448a44b3
commit aaf3b68e14
7 changed files with 148 additions and 57 deletions

View File

@@ -408,7 +408,7 @@ class phpUtilities:
return result
else:
command = f'grep -Po "php\d+" {vhFile} | head -n 1'
command = f'grep -Po "php\\d+" {vhFile} | head -n 1'
result = ProcessUtilities.outputExecutioner(command, None, True).rstrip('\n')
result = f'/usr/local/lsws/ls{result}/bin/lsphp'
result = result.rsplit("lsphp", 1)[0] + "php"
@@ -454,8 +454,28 @@ class phpUtilities:
if ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu or ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu20:
command = f'DEBIAN_FRONTEND=noninteractive apt-get -y install lsphp{php}*'
else:
command = f'dnf install lsphp{php}* --exclude lsphp73-pecl-zip --exclude *imagick* -y --skip-broken'
# Enhanced dependency handling for RHEL-based systems
# First try to install required dependencies
dependency_packages = [
'libmemcached', 'libmemcached-devel', 'libmemcached-libs',
'gd', 'gd-devel', 'libgd',
'c-client', 'c-client-devel',
'oniguruma', 'oniguruma-devel',
'libicu', 'libicu-devel',
'aspell', 'aspell-devel',
'pspell', 'pspell-devel'
]
# Install dependencies first
for dep in dependency_packages:
try:
dep_command = f'dnf install -y {dep} --skip-broken'
ProcessUtilities.executioner(dep_command, None, True)
except:
pass # Continue if dependency installation fails
# Install PHP with better error handling
command = f'dnf install lsphp{php}* --exclude *imagick* -y --skip-broken --nobest'
ProcessUtilities.executioner(command, None, True)

View File

@@ -4112,15 +4112,15 @@ echo $oConfig->Save() ? 'Done' : 'Error';
for version in available_versions:
try:
if version in ['71', '72', '73', '74']:
# PHP 7.x versions with specific extensions
if version in ['74']:
# PHP 7.4 only (legacy support) with specific extensions
if Upgrade.installedOutput.find(f'lsphp{version}') == -1:
extensions = ['json', 'xmlrpc', 'xml', 'tidy', 'soap', 'snmp', 'recode', 'pspell', 'process', 'pgsql', 'pear', 'pdo', 'opcache', 'odbc', 'mysqlnd', 'mcrypt', 'mbstring', 'ldap', 'intl', 'imap', 'gmp', 'gd', 'enchant', 'dba', 'common', 'bcmath']
package_list = f"lsphp{version} " + " ".join([f"lsphp{version}-{ext}" for ext in extensions])
command = f"yum install -y {package_list}"
Upgrade.executioner(command, f'Install PHP {version}', 0)
else:
# PHP 8.x versions
elif version in ['80', '81', '82', '83', '84', '85']:
# PHP 8.x versions (including 8.5 beta)
if Upgrade.installedOutput.find(f'lsphp{version}') == -1:
command = f"yum install lsphp{version}* -y"
subprocess.call(command, shell=True)