diff --git a/managePHP/phpManager.py b/managePHP/phpManager.py index ad03e017f..74ebca609 100644 --- a/managePHP/phpManager.py +++ b/managePHP/phpManager.py @@ -58,7 +58,7 @@ class PHPManager: # Method 2: Check system-wide PHP installations try: # Check for system PHP versions - system_php_versions = ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5'] + system_php_versions = ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5', '8.6'] for version in system_php_versions: formatted_version = f'PHP {version}' if formatted_version not in finalPHPVersions: @@ -117,7 +117,7 @@ class PHPManager: # Method 4: Fallback to checking common PHP versions if not finalPHPVersions: - fallback_versions = ['PHP 7.4', 'PHP 8.0', 'PHP 8.1', 'PHP 8.2', 'PHP 8.3', 'PHP 8.4', 'PHP 8.5'] + fallback_versions = ['PHP 7.4', 'PHP 8.0', 'PHP 8.1', 'PHP 8.2', 'PHP 8.3', 'PHP 8.4', 'PHP 8.5', 'PHP 8.6'] for version in fallback_versions: try: phpString = PHPManager.getPHPString(version) @@ -145,25 +145,18 @@ class PHPManager: from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging logging.writeToFile(f'Final PHP versions found: {finalPHPVersions}') - return finalPHPVersions if finalPHPVersions else ['PHP 7.4', 'PHP 8.0', 'PHP 8.1', 'PHP 8.2', 'PHP 8.3', 'PHP 8.4', 'PHP 8.5'] + return finalPHPVersions if finalPHPVersions else ['PHP 7.4', 'PHP 8.0', 'PHP 8.1', 'PHP 8.2', 'PHP 8.3', 'PHP 8.4', 'PHP 8.5', 'PHP 8.6'] except BaseException as msg: from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging logging.writeToFile(f'Error while finding php versions on system: {str(msg)}') - return ['PHP 7.4', 'PHP 8.0', 'PHP 8.1', 'PHP 8.2', 'PHP 8.3', 'PHP 8.4', 'PHP 8.5'] + return ['PHP 7.4', 'PHP 8.0', 'PHP 8.1', 'PHP 8.2', 'PHP 8.3', 'PHP 8.4', 'PHP 8.5', 'PHP 8.6'] @staticmethod def findApachePHPVersions(): - # distro = ProcessUtilities.decideDistro() - # if distro == ProcessUtilities.centos: - # return ['PHP 5.3', 'PHP 5.4', 'PHP 5.5', 'PHP 5.6', 'PHP 7.0', 'PHP 7.1', 'PHP 7.2', 'PHP 7.3', 'PHP 7.4', 'PHP 8.0', 'PHP 8.1'] - # elif distro == ProcessUtilities.cent8: - # return ['PHP 7.1','PHP 7.2', 'PHP 7.3', 'PHP 7.4', 'PHP 8.0', 'PHP 8.1'] - # elif distro == ProcessUtilities.ubuntu20: - # return ['PHP 7.2', 'PHP 7.3', 'PHP 7.4', 'PHP 8.0', 'PHP 8.1'] - # else: - # return ['PHP 7.0', 'PHP 7.1', 'PHP 7.2', 'PHP 7.3', 'PHP 7.4', 'PHP 8.0', 'PHP 8.1', 'PHP 8.2', 'PHP 8.3', 'PHP 8.4', 'PHP 8.5'] - + """ + Dynamically detect available Apache PHP versions by scanning the system + """ try: # Run the shell command and capture the output @@ -222,7 +215,7 @@ class PHPManager: except BaseException as msg: from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging logging.writeToFile(f'Error while finding php versions on system: {str(msg)}') - return ['PHP 7.0', 'PHP 7.1', 'PHP 7.2', 'PHP 7.3', 'PHP 7.4', 'PHP 8.0', 'PHP 8.1', 'PHP 8.2', 'PHP 8.3', 'PHP 8.4', 'PHP 8.5'] + return ['PHP 7.4', 'PHP 8.0', 'PHP 8.1', 'PHP 8.2', 'PHP 8.3', 'PHP 8.4', 'PHP 8.5', 'PHP 8.6'] @staticmethod def getPHPString(phpVersion): @@ -338,7 +331,7 @@ class PHPManager: return 'PHP 8.3' # Default recommendation # Priority order for recommendations - recommended_order = ['PHP 8.3', 'PHP 8.2', 'PHP 8.4', 'PHP 8.5', 'PHP 8.1', 'PHP 8.0', 'PHP 7.4'] + recommended_order = ['PHP 8.3', 'PHP 8.2', 'PHP 8.4', 'PHP 8.5', 'PHP 8.6', 'PHP 8.1', 'PHP 8.0', 'PHP 7.4'] for recommended in recommended_order: if recommended in all_versions: diff --git a/plogical/phpUtilities.py b/plogical/phpUtilities.py index 98041cd4b..3834cc7a9 100644 --- a/plogical/phpUtilities.py +++ b/plogical/phpUtilities.py @@ -372,7 +372,10 @@ class phpUtilities: centOSPHP = 'php85' ubuntuPHP = 'php8.5' - + phpPath = ApacheVhost.DecidePHPPath('86', virtualHostName) + if os.path.exists(phpPath): + centOSPHP = 'php86' + ubuntuPHP = 'php8.6' ######