From 93448a44b3e56d0d5c489b6a18e6d2905e9ed029 Mon Sep 17 00:00:00 2001 From: Master3395 Date: Wed, 24 Sep 2025 00:45:34 +0200 Subject: [PATCH 1/2] Add installation summary feature to cyberpanel.sh and install.py Implemented a comprehensive installation summary function in both cyberpanel.sh and install.py. The summary includes installation status, system resource usage, and troubleshooting steps for failed installations. Enhanced user feedback during the installation process to improve clarity and support for users. --- cyberpanel.sh | 120 +++++++++++++++++++++++++++++++++++++++++++-- install/install.py | 95 +++++++++++++++++++++++++++++++++++ 2 files changed, 211 insertions(+), 4 deletions(-) diff --git a/cyberpanel.sh b/cyberpanel.sh index d48b7944e..996aaffcd 100644 --- a/cyberpanel.sh +++ b/cyberpanel.sh @@ -2165,13 +2165,125 @@ fi /usr/local/CyberPanel-venv/bin/python install.py "${Final_Flags[@]}" +# Installation summary function +show_installation_summary() { + local install_status=$1 + local start_time=$2 + local end_time=$(date +%s) + local elapsed_time=$((end_time - start_time)) + local elapsed_minutes=$((elapsed_time / 60)) + local elapsed_seconds=$((elapsed_time % 60)) + + # Get system info + local memory_usage=$(free -m | awk 'NR==2{printf "%s/%sMB (%.1f%%)", $3,$2,$3*100/$2 }') + local disk_usage=$(df -h / | awk 'NR==2{print $5}' | sed 's/%//') + local cpu_cores=$(nproc) + local load_avg=$(uptime | awk -F'load average:' '{print $2}' | awk '{print $1}' | sed 's/,//') + + echo "" + echo "╔═══════════════════════════════════════════════════════════════════════════════════════════════════════════════╗" + echo "║ ║" + echo "║ 📊 CYBERPANEL INSTALLATION SUMMARY ║" + echo "║ ║" + echo "╚═══════════════════════════════════════════════════════════════════════════════════════════════════════════════╝" + echo "" + + if [ "$install_status" = "SUCCESS" ]; then + echo "╔═══════════════════════════════════════════════════════════════════════════════════════════════════════════════╗" + echo "║ ║" + echo "║ ✅ INSTALLATION STATUS: SUCCESSFUL ║" + echo "║ ║" + echo "║ 🌐 ACCESS YOUR CYBERPANEL: ║" + echo "║ • URL: https://$Server_IP:8090 ║" + echo "║ • Username: admin ║" + if [[ "$Custom_Pass" = "True" ]]; then + echo "║ • Password: ***** (custom password) ║" + else + echo "║ • Password: $Admin_Pass ║" + fi + echo "║ ║" + echo "║ 🎉 ALL COMPONENTS INSTALLED SUCCESSFULLY! 🎉 ║" + echo "║ ║" + echo "╚═══════════════════════════════════════════════════════════════════════════════════════════════════════════════╝" + else + echo "╔═══════════════════════════════════════════════════════════════════════════════════════════════════════════════╗" + echo "║ ║" + echo "║ ❌ INSTALLATION STATUS: FAILED ║" + echo "║ ║" + echo "║ 🔍 TROUBLESHOOTING STEPS: ║" + echo "║ 1. Check the installation logs: ║" + echo "║ • Main log: /var/log/installLogs.txt ║" + echo "║ • Debug log: /var/log/cyberpanel/cyberpanel_install_debug_*.log ║" + echo "║ ║" + echo "║ 2. Common issues and solutions: ║" + echo "║ • Insufficient memory: Ensure at least 1GB RAM available ║" + echo "║ • Disk space: Ensure at least 10GB free space ║" + echo "║ • Network issues: Check internet connectivity ║" + echo "║ • Repository errors: Try running 'yum clean all' or 'apt update' ║" + echo "║ ║" + echo "║ 3. Get help: ║" + echo "║ • Community: https://community.cyberpanel.net ║" + echo "║ • Documentation: https://cyberpanel.net/KnowledgeBase/ ║" + echo "║ • GitHub Issues: https://github.com/usmannasir/cyberpanel/issues ║" + echo "║ ║" + echo "║ 🛠️ RETRY INSTALLATION: ║" + echo "║ bash <(curl https://raw.githubusercontent.com/usmannasir/cyberpanel/v2.5.5-dev/cyberpanel.sh) --debug ║" + echo "║ ║" + echo "╚═══════════════════════════════════════════════════════════════════════════════════════════════════════════════╝" + fi + + echo "" + echo "╔═══════════════════════════════════════════════════════════════════════════════════════════════════════════════╗" + echo "║ ║" + echo "║ 📈 SYSTEM INFORMATION: ║" + echo "║ • OS: $Server_OS $Server_OS_Version ║" + echo "║ • CPU Cores: $cpu_cores ║" + echo "║ • Load Average: $load_avg ║" + echo "║ • Memory Usage: $memory_usage ║" + echo "║ • Disk Usage: ${disk_usage}% ║" + echo "║ • Install Time: ${elapsed_minutes}m ${elapsed_seconds}s ║" + echo "║ ║" + echo "╚═══════════════════════════════════════════════════════════════════════════════════════════════════════════════╝" + + # Show recent errors if installation failed + if [ "$install_status" = "FAILED" ]; then + echo "" + echo "╔═══════════════════════════════════════════════════════════════════════════════════════════════════════════════╗" + echo "║ ║" + echo "║ 🚨 RECENT ERRORS: ║" + echo "║ ║" + + # Show last 10 lines of install log with errors + if [ -f "/var/log/installLogs.txt" ]; then + echo "║ From /var/log/installLogs.txt: ║" + tail -10 /var/log/installLogs.txt | while read line; do + if [ ${#line} -gt 100 ]; then + echo "║ ${line:0:100}... ║" + else + printf "║ %-100s ║\n" "$line" + fi + done + fi + + echo "║ ║" + echo "╚═══════════════════════════════════════════════════════════════════════════════════════════════════════════════╝" + fi + + echo "" +} + +# Record installation start time +INSTALL_START_TIME=$(date +%s) + if grep "CyberPanel installation successfully completed" /var/log/installLogs.txt >/dev/null; then - echo -e "\nCyberPanel installation sucessfully completed...\n" + echo -e "\nCyberPanel installation successfully completed...\n" Debug_Log2 "Main installation completed...,70" + show_installation_summary "SUCCESS" "$INSTALL_START_TIME" else - echo -e "Oops, something went wrong..." - Debug_Log2 "Oops, something went wrong... [404]" - exit + echo -e "Installation encountered issues..." + Debug_Log2 "Installation encountered issues... [404]" + show_installation_summary "FAILED" "$INSTALL_START_TIME" + exit 1 fi } diff --git a/install/install.py b/install/install.py index 1ad5b0db3..2c4476da1 100644 --- a/install/install.py +++ b/install/install.py @@ -3693,8 +3693,103 @@ echo $oConfig->Save() ? 'Done' : 'Error'; # These services require database tables that are created by Django migrations checks.startDeferredServices() + # Installation summary + show_installation_summary() + logging.InstallLog.writeToFile("CyberPanel installation successfully completed!,80") +def show_installation_summary(): + """Display comprehensive installation summary""" + try: + import time + import subprocess + + print("\n" + "="*80) + print("📊 CYBERPANEL INSTALLATION SUMMARY") + print("="*80) + + # Check component status + components = { + "CyberPanel Core": check_service_status("lscpd"), + "OpenLiteSpeed": check_service_status("lsws"), + "MariaDB/MySQL": check_service_status("mysql") or check_service_status("mariadb"), + "PowerDNS": check_service_status("pdns") or check_service_status("pdns-server"), + "Pure-FTPd": check_service_status("pure-ftpd"), + "Postfix": check_service_status("postfix"), + "Dovecot": check_service_status("dovecot"), + "SnappyMail": check_file_exists("/usr/local/CyberCP/public/snappymail"), + "phpMyAdmin": check_file_exists("/usr/local/CyberCP/public/phpmyadmin") + } + + print("\n🔧 COMPONENT STATUS:") + print("-" * 50) + for component, status in components.items(): + if status: + print(f"✅ {component:<20} - INSTALLED & RUNNING") + else: + print(f"❌ {component:<20} - NOT AVAILABLE") + + # System information + try: + memory_info = subprocess.check_output("free -m", shell=True).decode() + memory_line = [line for line in memory_info.split('\n') if 'Mem:' in line][0] + memory_parts = memory_line.split() + total_mem = memory_parts[1] + used_mem = memory_parts[2] + mem_percent = (int(used_mem) / int(total_mem)) * 100 + + disk_info = subprocess.check_output("df -h /", shell=True).decode() + disk_line = [line for line in disk_info.split('\n') if '/dev/' in line][0] + disk_parts = disk_line.split() + disk_usage = disk_parts[4] + + print(f"\n📈 SYSTEM RESOURCES:") + print(f" • Memory Usage: {used_mem}MB / {total_mem}MB ({mem_percent:.1f}%)") + print(f" • Disk Usage: {disk_usage}") + print(f" • CPU Cores: {subprocess.check_output('nproc', shell=True).decode().strip()}") + + except Exception as e: + print(f"\n📈 SYSTEM RESOURCES: Unable to retrieve ({str(e)})") + + # Installation time + try: + if hasattr(show_installation_summary, 'start_time'): + elapsed = time.time() - show_installation_summary.start_time + minutes = int(elapsed // 60) + seconds = int(elapsed % 60) + print(f" • Install Time: {minutes}m {seconds}s") + except: + pass + + print("\n" + "="*80) + + except Exception as e: + print(f"\n⚠️ Could not generate installation summary: {str(e)}") + + +def check_service_status(service_name): + """Check if a service is running""" + try: + result = subprocess.run(['systemctl', 'is-active', service_name], + capture_output=True, text=True) + return result.returncode == 0 + except: + return False + + +def check_file_exists(file_path): + """Check if a file or directory exists""" + try: + return os.path.exists(file_path) + except: + return False + + +# Set installation start time +import time +show_installation_summary.start_time = time.time() + + if __name__ == "__main__": main() From aaf3b68e146d625f1fbfa2870a7d74bb5ff89928 Mon Sep 17 00:00:00 2001 From: Master3395 Date: Wed, 24 Sep 2025 01:11:23 +0200 Subject: [PATCH 2/2] 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. --- README.md | 5 +- cyberpanel.sh | 57 +++++++++++++---------- cyberpanel_upgrade.sh | 3 +- install/install.py | 17 +++++-- install/installCyberPanel.py | 89 ++++++++++++++++++++++++++++-------- plogical/phpUtilities.py | 26 +++++++++-- plogical/upgrade.py | 8 ++-- 7 files changed, 148 insertions(+), 57 deletions(-) diff --git a/README.md b/README.md index 2addac9c5..11a6adece 100755 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ **Web Hosting Control Panel powered by OpenLiteSpeed** Fast • Secure • Scalable — Simplify hosting management with style. -**Version**: 2.5.5 • **Updated**: September 23, 2025 +**Version**: 2.5.5 • **Updated**: September 24, 2025 [![GitHub](https://img.shields.io/badge/GitHub-Repo-000?style=flat-square\&logo=github)](https://github.com/usmannasir/cyberpanel) [![Docs](https://img.shields.io/badge/Docs-Read-green?style=flat-square\&logo=gitbook)](https://cyberpanel.net/KnowledgeBase/) @@ -84,8 +84,9 @@ Fast • Secure • Scalable — Simplify hosting management with style. ## PHP support (short) -* ✅ **Recommended**: PHP 8.5, 8.4, 8.3, 8.2, 8.1 +* ✅ **Recommended**: PHP 8.5 (beta), 8.4, 8.3, 8.2, 8.1 * ⚠️ **Legacy**: PHP 8.0, PHP 7.4 (security-only) +* ❌ **Deprecated**: PHP 7.1, 7.2, 7.3 (no longer installed) Third-party repositories (Remi, Ondrej) may provide older or niche versions; verify compatibility before use. diff --git a/cyberpanel.sh b/cyberpanel.sh index 996aaffcd..242e9c78a 100644 --- a/cyberpanel.sh +++ b/cyberpanel.sh @@ -347,23 +347,16 @@ install_php_packages() { return 0 fi - # Try to install packages for each available PHP version - packages_to_install="" + # Try to install packages for each available PHP version individually for php_version in $available_php_versions; do - # Check if package exists before adding to install list + # Check if package exists before installing if yum search ${php_version}-${php_extension} 2>/dev/null | grep -q "${php_version}-${php_extension}"; then - packages_to_install="${packages_to_install} ${php_version}-${php_extension}" + install_package "${php_version}-${php_extension}" || log_warning "Failed to install ${php_version}-${php_extension}" fi if yum search ${php_version}-pecl-${php_extension} 2>/dev/null | grep -q "${php_version}-pecl-${php_extension}"; then - packages_to_install="${packages_to_install} ${php_version}-pecl-${php_extension}" + install_package "${php_version}-pecl-${php_extension}" || log_warning "Failed to install ${php_version}-pecl-${php_extension}" fi done - - if [[ -n "$packages_to_install" ]]; then - install_package "$packages_to_install" - else - log_warning "No matching ${php_extension} packages found for available PHP versions" - fi ;; "CentOS8"|"CentOS9"|"CentOSStream8"|"CentOSStream9"|"RHEL8"|"RHEL9"|"AlmaLinux8"|"AlmaLinux9"|"AlmaLinux10"|"RockyLinux8"|"RockyLinux9"|"openEuler2003"|"openEuler2203"|"openEuler2403") # Find available PHP versions first @@ -373,23 +366,16 @@ install_php_packages() { return 0 fi - # Try to install packages for each available PHP version - packages_to_install="" + # Try to install packages for each available PHP version individually for php_version in $available_php_versions; do - # Check if package exists before adding to install list + # Check if package exists before installing if dnf search ${php_version}-${php_extension} 2>/dev/null | grep -q "${php_version}-${php_extension}"; then - packages_to_install="${packages_to_install} ${php_version}-${php_extension}" + install_package "${php_version}-${php_extension}" || log_warning "Failed to install ${php_version}-${php_extension}" fi if dnf search ${php_version}-pecl-${php_extension} 2>/dev/null | grep -q "${php_version}-pecl-${php_extension}"; then - packages_to_install="${packages_to_install} ${php_version}-pecl-${php_extension}" + install_package "${php_version}-pecl-${php_extension}" || log_warning "Failed to install ${php_version}-pecl-${php_extension}" fi done - - if [[ -n "$packages_to_install" ]]; then - install_package "$packages_to_install" - else - log_warning "No matching ${php_extension} packages found for available PHP versions" - fi ;; "Ubuntu1804"|"Ubuntu2004"|"Ubuntu2010"|"Ubuntu2204"|"Ubuntu2404"|"Ubuntu24043"|"Debian11"|"Debian12"|"Debian13") # Find available PHP versions first @@ -2290,6 +2276,13 @@ fi Post_Install_Addon_Mecached_LSMCD() { install_dev_tools + # Install SASL development headers for LSMCD compilation + if [[ "$Server_OS" =~ ^(CentOS|RHEL|AlmaLinux|RockyLinux|CloudLinux|openEuler) ]] ; then + dnf install -y cyrus-sasl-devel cyrus-sasl-lib cyrus-sasl-gssapi cyrus-sasl-plain || yum install -y cyrus-sasl-devel cyrus-sasl-lib cyrus-sasl-gssapi cyrus-sasl-plain + elif [[ "$Server_OS" = "Ubuntu" ]] ; then + apt-get install -y libsasl2-dev libsasl2-modules + fi + wget -O lsmcd-master.zip https://cyberpanel.sh/codeload.github.com/litespeedtech/lsmcd/zip/master unzip lsmcd-master.zip Current_Dir=$(pwd) @@ -2332,8 +2325,24 @@ Post_Install_Addon_Memcached() { Post_Install_Addon_Redis() { log_function_start "Post_Install_Addon_Redis" log_info "Installing Redis server and PHP extension" - # Install PHP Redis extension - install_php_packages "redis" + + # Install PHP Redis extension for available PHP versions + # Check which PHP versions are actually installed + for php_version in $(ls /usr/local/lsws/lsphp* 2>/dev/null | grep -o 'lsphp[0-9]*' | sort -u); do + if [[ "$Server_OS" =~ ^(CentOS|RHEL|AlmaLinux|RockyLinux|CloudLinux|openEuler) ]] ; then + # Try to install Redis extension for this PHP version + if dnf search ${php_version}-pecl-redis 2>/dev/null | grep -q "${php_version}-pecl-redis"; then + dnf install -y ${php_version}-pecl-redis || yum install -y ${php_version}-pecl-redis + elif dnf search ${php_version}-redis 2>/dev/null | grep -q "${php_version}-redis"; then + dnf install -y ${php_version}-redis || yum install -y ${php_version}-redis + fi + elif [[ "$Server_OS" = "Ubuntu" ]] ; then + # Ubuntu Redis extension installation + if apt-cache search ${php_version}-redis 2>/dev/null | grep -q "${php_version}-redis"; then + apt-get install -y ${php_version}-redis + fi + fi + done # Install Redis server if [[ "$Server_OS" = "CentOS" ]]; then diff --git a/cyberpanel_upgrade.sh b/cyberpanel_upgrade.sh index 703e44729..62b599e68 100644 --- a/cyberpanel_upgrade.sh +++ b/cyberpanel_upgrade.sh @@ -1257,7 +1257,8 @@ if [[ ! -f /usr/local/lscp/fcgi-bin/lsphp ]] || [[ ! -s /usr/local/lscp/fcgi-bin PHP_RESTORED=0 # Try to find the latest lsphp version (check from newest to oldest) - for PHP_VER in 83 82 81 80 74 73 72; do + # Priority: 85 (beta), 84, 83, 82, 81, 80, 74 + for PHP_VER in 85 84 83 82 81 80 74; do if [[ -f /usr/local/lsws/lsphp${PHP_VER}/bin/lsphp ]]; then # Try to create symlink first (preferred) if ln -sf /usr/local/lsws/lsphp${PHP_VER}/bin/lsphp /usr/local/lscp/fcgi-bin/lsphp 2>/dev/null; then diff --git a/install/install.py b/install/install.py index 2c4476da1..87f61ee3d 100644 --- a/install/install.py +++ b/install/install.py @@ -1248,10 +1248,19 @@ $cfg['Servers'][$i]['LogoutURL'] = 'phpmyadminsignin.php?logout'; ## + # Remove conflicting dovecot packages first + try: + if self.distro in [centos, cent8]: + preFlightsChecks.call('yum remove -y dovecot dovecot-*', self.distro, + 'Remove conflicting dovecot packages', + 'Remove conflicting dovecot packages', 1, 0, os.EX_OSERR) + except: + pass # Continue if removal fails + if self.distro == centos: - command = 'yum --enablerepo=gf-plus -y install dovecot23 dovecot23-mysql' + command = 'yum --enablerepo=gf-plus -y install dovecot23 dovecot23-mysql --allowerasing' elif self.distro == cent8: - command = 'dnf install --enablerepo=gf-plus dovecot23 dovecot23-mysql -y' + command = 'dnf install --enablerepo=gf-plus dovecot23 dovecot23-mysql -y --allowerasing' elif self.distro == openeuler: command = 'dnf install dovecot -y' else: @@ -2693,8 +2702,8 @@ milter_default_action = accept logging.InstallLog.writeToFile("[setup_lsphp_symlink] Removed existing lsphp file/symlink") # Try to find and use the best available PHP version - # Priority: 83, 82, 81, 80, 74, 73, 72 (newest to oldest) - php_versions = ['83', '82', '81', '80', '74', '73', '72'] + # Priority: 85 (beta), 84, 83, 82, 81, 80, 74 (newest to oldest) + php_versions = ['85', '84', '83', '82', '81', '80', '74'] lsphp_source = None for php_ver in php_versions: diff --git a/install/installCyberPanel.py b/install/installCyberPanel.py index 685a1baef..91d9dcfc1 100644 --- a/install/installCyberPanel.py +++ b/install/installCyberPanel.py @@ -391,42 +391,93 @@ class InstallCyberPanel: return self.reStartLiteSpeed() + def installPHPDependencies(self): + """Install required dependencies for PHP extensions""" + try: + InstallCyberPanel.stdOut("Installing PHP dependencies...", 1) + + if self.distro == ubuntu: + # Ubuntu dependencies + deps = [ + 'libmemcached-dev', 'libmemcached11', + 'libgd-dev', 'libgd3', + 'libc-client2007e-dev', 'libc-client2007e', + 'libonig-dev', 'libonig5', + 'libicu-dev', 'libicu70', + 'libaspell-dev', 'libaspell15', + 'libpspell-dev', 'libpspell1' + ] + command = f'DEBIAN_FRONTEND=noninteractive apt-get -y install {" ".join(deps)}' + os.system(command) + else: + # RHEL-based dependencies - enhanced list + deps = [ + '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', + 'sendmail-milter', 'sendmail-milter-devel', # For libmilter + 'GeoIP', 'GeoIP-devel', # For geoip-devel + 'udns', 'udns-devel', # For udns-devel + 'sasl', 'cyrus-sasl-devel', # For SASL headers + 'libmilter', 'sendmail-milter-devel' # For libmilter.so.1.0 + ] + + for dep in deps: + try: + self.install_package(dep, '--skip-broken') + except: + pass # Continue if dependency installation fails + + except Exception as e: + InstallCyberPanel.stdOut(f"Warning: Some PHP dependencies may not be available: {str(e)}", 0) + def installAllPHPVersions(self): - php_versions = ['71', '72', '73', '74', '80', '81', '82', '83', '84', '85'] + # Install PHP dependencies first + self.installPHPDependencies() + + # Updated PHP versions: Only 7.4+ and use 8.5 as beta + # Priority: 85 (beta), 84, 83, 82, 81, 80, 74 + php_versions = ['74', '80', '81', '82', '83', '84', '85'] if self.distro == ubuntu: - # Install base PHP 7.x packages + # Install PHP 7.4 only (legacy support) with mbstring command = 'DEBIAN_FRONTEND=noninteractive apt-get -y install ' \ - 'lsphp7? lsphp7?-common lsphp7?-curl lsphp7?-dev lsphp7?-imap lsphp7?-intl lsphp7?-json ' \ - 'lsphp7?-ldap lsphp7?-mysql lsphp7?-opcache lsphp7?-pspell lsphp7?-recode ' \ - 'lsphp7?-sqlite3 lsphp7?-tidy' + 'lsphp74 lsphp74-common lsphp74-curl lsphp74-dev lsphp74-imap lsphp74-intl lsphp74-json ' \ + 'lsphp74-ldap lsphp74-mysql lsphp74-opcache lsphp74-pspell lsphp74-recode ' \ + 'lsphp74-sqlite3 lsphp74-tidy lsphp74-mbstring' os.system(command) - # Install PHP 8.x versions - for version in php_versions[4:]: # 80, 81, 82, 83 + # Install PHP 8.x versions (8.0 to 8.5) with mbstring + for version in php_versions[1:]: # 80, 81, 82, 83, 84, 85 self.install_package(f'lsphp{version}*') + # Ensure mbstring is installed for each version + try: + self.install_package(f'lsphp{version}-mbstring') + except: + pass elif self.distro == centos: - # First install the group - command = 'yum -y groupinstall lsphp-all' - install_utils.call(command, self.distro, command, command, 1, 1, os.EX_OSERR) + # Install PHP 7.4 only (legacy support) + self.install_package('lsphp74*', '--skip-broken') - InstallCyberPanel.stdOut("LiteSpeed PHPs successfully installed!", 1) - - # Install individual PHP versions - for version in php_versions: + # Install PHP 8.x versions + for version in php_versions[1:]: # 80, 81, 82, 83, 84, 85 self.install_package(f'lsphp{version}*', '--skip-broken') elif self.distro == cent8: # Install PHP versions in batches with exclusions - exclude_flags = "--exclude lsphp73-pecl-zip --exclude *imagick*" + exclude_flags = "--exclude *imagick*" - # First batch: PHP 7.x and 8.0 - versions_batch1 = ' '.join([f'lsphp{v}*' for v in php_versions[:5]]) + # First batch: PHP 7.4 and 8.0-8.2 + versions_batch1 = 'lsphp74* lsphp80* lsphp81* lsphp82*' self.install_package(versions_batch1, f'{exclude_flags} --skip-broken') - # Second batch: PHP 8.1+ - versions_batch2 = ' '.join([f'lsphp{v}*' for v in php_versions[5:]]) + # Second batch: PHP 8.3-8.5 (including beta 8.5) + versions_batch2 = 'lsphp83* lsphp84* lsphp85*' self.install_package(versions_batch2, f'{exclude_flags} --skip-broken') elif self.distro == openeuler: diff --git a/plogical/phpUtilities.py b/plogical/phpUtilities.py index 45e2d6cf2..98041cd4b 100644 --- a/plogical/phpUtilities.py +++ b/plogical/phpUtilities.py @@ -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) diff --git a/plogical/upgrade.py b/plogical/upgrade.py index f3e28cbef..f6129ca59 100644 --- a/plogical/upgrade.py +++ b/plogical/upgrade.py @@ -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)