mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-06 21:35:55 +01:00
bug fix: fetch dynamic php versions for apache on ubuntu
This commit is contained in:
@@ -75,6 +75,8 @@ class PHPManager:
|
|||||||
from ApachController.ApacheController import ApacheController as ApachController
|
from ApachController.ApacheController import ApacheController as ApachController
|
||||||
result = ProcessUtilities.outputExecutioner(f'ls -la {ApachController.phpBasepath}')
|
result = ProcessUtilities.outputExecutioner(f'ls -la {ApachController.phpBasepath}')
|
||||||
|
|
||||||
|
if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8:
|
||||||
|
|
||||||
# Get the lines containing 'lsphp' in the output
|
# Get the lines containing 'lsphp' in the output
|
||||||
lsphp_lines = [line for line in result.split('\n') if 'php' in line]
|
lsphp_lines = [line for line in result.split('\n') if 'php' in line]
|
||||||
|
|
||||||
@@ -91,6 +93,28 @@ class PHPManager:
|
|||||||
# Format version as PHP X.Y
|
# Format version as PHP X.Y
|
||||||
formatted_version = f"PHP {version[0]}.{version[1]}"
|
formatted_version = f"PHP {version[0]}.{version[1]}"
|
||||||
php_versions.append(formatted_version)
|
php_versions.append(formatted_version)
|
||||||
|
else:
|
||||||
|
|
||||||
|
lsphp_lines = [line for line in result.split('\n')]
|
||||||
|
|
||||||
|
if os.path.exists(ProcessUtilities.debugPath):
|
||||||
|
from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging
|
||||||
|
logging.writeToFile(f'Found PHP lines in findApachePHPVersions: {lsphp_lines}')
|
||||||
|
|
||||||
|
# Extract the version from the lines and format it as 'PHP x.y'
|
||||||
|
# Extract and format PHP versions
|
||||||
|
php_versions = []
|
||||||
|
for entry in lsphp_lines:
|
||||||
|
# Find substring starting with 'php' and extract the version part
|
||||||
|
try:
|
||||||
|
version = entry.split('.')
|
||||||
|
# Format version as PHP X.Y
|
||||||
|
formatted_version = f"PHP {version[-2][-1]}.{version[-1]}"
|
||||||
|
if formatted_version != 'PHP .':
|
||||||
|
php_versions.append(formatted_version)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user