mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-10-26 07:46:35 +01:00
bug fixes to wp installation
This commit is contained in:
40
.idea/workspace.xml
generated
40
.idea/workspace.xml
generated
@@ -38,27 +38,27 @@
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent">{
|
||||
"keyToString": {
|
||||
"ModuleVcsDetector.initialDetectionPerformed": "true",
|
||||
"Notification.DisplayName-DoNotAsk-DatabaseConfigFileWatcher.found": "Database connection parameters found",
|
||||
"Notification.DoNotAsk-DatabaseConfigFileWatcher.found": "true",
|
||||
"RunOnceActivity.OpenDjangoStructureViewOnStart": "true",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"RunOnceActivity.TerminalTabsStorage.copyFrom.TerminalArrangementManager": "true",
|
||||
"RunOnceActivity.git.unshallow": "true",
|
||||
"SHELLCHECK.PATH": "/Users/cyberpersons/Library/Application Support/JetBrains/PyCharm2025.1/plugins/Shell Script/shellcheck",
|
||||
"git-widget-placeholder": "v2.4.3",
|
||||
"last_opened_file_path": "/Users/cyberpersons/cyberpanel",
|
||||
"node.js.detected.package.eslint": "true",
|
||||
"node.js.detected.package.tslint": "true",
|
||||
"node.js.selected.package.eslint": "(autodetect)",
|
||||
"node.js.selected.package.tslint": "(autodetect)",
|
||||
"nodejs_package_manager_path": "npm",
|
||||
"settings.editor.selected.configurable": "preferences.pluginManager",
|
||||
"vue.rearranger.settings.migration": "true"
|
||||
<component name="PropertiesComponent"><![CDATA[{
|
||||
"keyToString": {
|
||||
"ModuleVcsDetector.initialDetectionPerformed": "true",
|
||||
"Notification.DisplayName-DoNotAsk-DatabaseConfigFileWatcher.found": "Database connection parameters found",
|
||||
"Notification.DoNotAsk-DatabaseConfigFileWatcher.found": "true",
|
||||
"RunOnceActivity.OpenDjangoStructureViewOnStart": "true",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"RunOnceActivity.TerminalTabsStorage.copyFrom.TerminalArrangementManager": "true",
|
||||
"RunOnceActivity.git.unshallow": "true",
|
||||
"SHELLCHECK.PATH": "/Users/cyberpersons/Library/Application Support/JetBrains/PyCharm2025.1/plugins/Shell Script/shellcheck",
|
||||
"git-widget-placeholder": "stable",
|
||||
"last_opened_file_path": "/Users/cyberpersons/cyberpanel",
|
||||
"node.js.detected.package.eslint": "true",
|
||||
"node.js.detected.package.tslint": "true",
|
||||
"node.js.selected.package.eslint": "(autodetect)",
|
||||
"node.js.selected.package.tslint": "(autodetect)",
|
||||
"nodejs_package_manager_path": "npm",
|
||||
"settings.editor.selected.configurable": "preferences.pluginManager",
|
||||
"vue.rearranger.settings.migration": "true"
|
||||
}
|
||||
}</component>
|
||||
}]]></component>
|
||||
<component name="RunManager">
|
||||
<configuration name="cyberpanel" type="Python.DjangoServer" factoryName="Django server">
|
||||
<module name="cyberpanel" />
|
||||
|
||||
@@ -2156,15 +2156,32 @@ milter_default_action = accept
|
||||
|
||||
def setupPHPSymlink(self):
|
||||
try:
|
||||
# Check if PHP 8.3 exists
|
||||
if not os.path.exists('/usr/local/lsws/lsphp83/bin/php'):
|
||||
logging.InstallLog.writeToFile("[setupPHPSymlink] PHP 8.3 not found, ensuring it's installed...")
|
||||
|
||||
# Install PHP 8.3 based on OS
|
||||
if self.distro == centos or self.distro == cent8 or self.distro == openeuler:
|
||||
command = 'yum install lsphp83 lsphp83-* -y'
|
||||
else:
|
||||
command = 'DEBIAN_FRONTEND=noninteractive apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y install lsphp83 lsphp83-*'
|
||||
|
||||
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
|
||||
|
||||
# Verify installation
|
||||
if not os.path.exists('/usr/local/lsws/lsphp83/bin/php'):
|
||||
logging.InstallLog.writeToFile('[ERROR] Failed to install PHP 8.3')
|
||||
return 0
|
||||
|
||||
# Remove existing PHP symlink if it exists
|
||||
if os.path.exists('/usr/bin/php'):
|
||||
os.remove('/usr/bin/php')
|
||||
|
||||
# Create symlink to PHP 8.1
|
||||
command = 'ln -s /usr/local/lsws/lsphp81/bin/php /usr/bin/php'
|
||||
# Create symlink to PHP 8.3
|
||||
command = 'ln -s /usr/local/lsws/lsphp83/bin/php /usr/bin/php'
|
||||
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
|
||||
|
||||
logging.InstallLog.writeToFile("[setupPHPSymlink] PHP symlink created successfully.")
|
||||
logging.InstallLog.writeToFile("[setupPHPSymlink] PHP symlink updated to PHP 8.3 successfully.")
|
||||
|
||||
except OSError as msg:
|
||||
logging.InstallLog.writeToFile('[ERROR] ' + str(msg) + " [setupPHPSymlink]")
|
||||
|
||||
@@ -654,17 +654,17 @@ class ApplicationInstaller(multi.Thread):
|
||||
completePathToConfigFile = f'/usr/local/lsws/conf/vhosts/{domainName}/vhost.conf'
|
||||
|
||||
execPath = "/usr/local/CyberCP/bin/python " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py"
|
||||
execPath = execPath + " changePHP --phpVersion 'PHP 8.2' --path " + completePathToConfigFile
|
||||
execPath = execPath + " changePHP --phpVersion 'PHP 8.3' --path " + completePathToConfigFile
|
||||
ProcessUtilities.executioner(execPath)
|
||||
|
||||
### lets first find php path
|
||||
|
||||
|
||||
|
||||
command = "sed -i.bak 's/^memory_limit = .*/memory_limit = 256M/' /usr/local/lsws/lsphp82/etc/php/8.2/litespeed/php.ini"
|
||||
command = "sed -i.bak 's/^memory_limit = .*/memory_limit = 256M/' /usr/local/lsws/lsphp83/etc/php/8.3/litespeed/php.ini"
|
||||
ProcessUtilities.executioner(command)
|
||||
|
||||
command = "sed -i.bak 's/^memory_limit = .*/memory_limit = 256M/' /usr/local/lsws/lsphp82/etc/php.ini"
|
||||
command = "sed -i.bak 's/^memory_limit = .*/memory_limit = 256M/' /usr/local/lsws/lsphp83/etc/php.ini"
|
||||
ProcessUtilities.executioner(command)
|
||||
|
||||
from plogical.phpUtilities import phpUtilities
|
||||
@@ -674,16 +674,16 @@ class ApplicationInstaller(multi.Thread):
|
||||
try:
|
||||
phpPath = phpUtilities.GetPHPVersionFromFile(vhFile)
|
||||
except:
|
||||
phpPath = '/usr/local/lsws/lsphp80/bin/php'
|
||||
phpPath = '/usr/local/lsws/lsphp83/bin/php'
|
||||
|
||||
|
||||
### basically for now php 8.2 is being checked
|
||||
### basically for now php 8.3 is being checked
|
||||
|
||||
if not os.path.exists(phpPath):
|
||||
statusFile = open(tempStatusPath, 'w')
|
||||
statusFile.writelines('PHP 8.2 missing installing now..,20')
|
||||
statusFile.writelines('PHP 8.3 missing installing now..,20')
|
||||
statusFile.close()
|
||||
phpUtilities.InstallSaidPHP('82')
|
||||
phpUtilities.InstallSaidPHP('83')
|
||||
|
||||
|
||||
finalPath = ''
|
||||
@@ -745,8 +745,16 @@ class ApplicationInstaller(multi.Thread):
|
||||
command = "rm -rf " + finalPath + "index.html"
|
||||
ProcessUtilities.executioner(command, externalApp)
|
||||
|
||||
#php = PHPManager.getPHPString(website.phpSelection)
|
||||
FinalPHPPath = phpPath
|
||||
# Always use PHP 8.3 for WordPress installation
|
||||
FinalPHPPath = '/usr/local/lsws/lsphp83/bin/php'
|
||||
|
||||
# Ensure PHP 8.3 is installed
|
||||
if not os.path.exists(FinalPHPPath):
|
||||
from plogical.phpUtilities import phpUtilities
|
||||
phpUtilities.InstallSaidPHP('83')
|
||||
if not os.path.exists(FinalPHPPath):
|
||||
# Fallback to detected PHP path if 8.3 install fails
|
||||
FinalPHPPath = phpPath
|
||||
|
||||
## Security Check
|
||||
|
||||
@@ -774,7 +782,8 @@ class ApplicationInstaller(multi.Thread):
|
||||
try:
|
||||
command = f"{FinalPHPPath} -d error_reporting=0 /usr/bin/wp core download --allow-root --path={finalPath} --version={self.extraArgs['WPVersion']}"
|
||||
except:
|
||||
command = "wp core download --allow-root --path=" + finalPath
|
||||
# Fallback to using explicit PHP 8.3 path even in exception
|
||||
command = f"/usr/local/lsws/lsphp83/bin/php -d error_reporting=0 /usr/bin/wp core download --allow-root --path={finalPath}"
|
||||
|
||||
result = ProcessUtilities.outputExecutioner(command, externalApp)
|
||||
|
||||
@@ -1914,7 +1923,7 @@ class ApplicationInstaller(multi.Thread):
|
||||
|
||||
DataToPass['domainName'] = self.data['domainName']
|
||||
DataToPass['adminEmail'] = self.data['adminEmail']
|
||||
DataToPass['phpSelection'] = "PHP 8.2"
|
||||
DataToPass['phpSelection'] = "PHP 8.3"
|
||||
DataToPass['websiteOwner'] = self.data['websiteOwner']
|
||||
DataToPass['package'] = self.data['package']
|
||||
DataToPass['ssl'] = 1
|
||||
@@ -1930,8 +1939,8 @@ class ApplicationInstaller(multi.Thread):
|
||||
try:
|
||||
website = Websites.objects.get(domain=DataToPass['domainName'])
|
||||
|
||||
if website.phpSelection == 'PHP 7.3':
|
||||
website.phpSelection = 'PHP 8.2'
|
||||
if website.phpSelection == 'PHP 7.3' or website.phpSelection == 'PHP 8.2':
|
||||
website.phpSelection = 'PHP 8.3'
|
||||
website.save()
|
||||
|
||||
admin = Administrator.objects.get(pk=self.extraArgs['adminID'])
|
||||
|
||||
@@ -3645,15 +3645,32 @@ pm.max_spare_servers = 3
|
||||
@staticmethod
|
||||
def setupPHPSymlink():
|
||||
try:
|
||||
# Check if PHP 8.3 exists
|
||||
if not os.path.exists('/usr/local/lsws/lsphp83/bin/php'):
|
||||
Upgrade.stdOut("PHP 8.3 not found, installing it first...")
|
||||
|
||||
# Install PHP 8.3 based on OS
|
||||
if os.path.exists(Upgrade.CentOSPath) or os.path.exists(Upgrade.openEulerPath):
|
||||
command = 'yum install lsphp83 lsphp83-* -y'
|
||||
Upgrade.executioner(command, 'Install PHP 8.3', 0)
|
||||
else:
|
||||
command = 'DEBIAN_FRONTEND=noninteractive apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y install lsphp83 lsphp83-*'
|
||||
Upgrade.executioner(command, 'Install PHP 8.3', 0)
|
||||
|
||||
# Verify installation
|
||||
if not os.path.exists('/usr/local/lsws/lsphp83/bin/php'):
|
||||
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'):
|
||||
os.remove('/usr/bin/php')
|
||||
|
||||
# Create symlink to PHP 8.1
|
||||
command = 'ln -s /usr/local/lsws/lsphp81/bin/php /usr/bin/php'
|
||||
Upgrade.executioner(command, 'Setup PHP Symlink', 0)
|
||||
# Create symlink to PHP 8.3
|
||||
command = 'ln -s /usr/local/lsws/lsphp83/bin/php /usr/bin/php'
|
||||
Upgrade.executioner(command, 'Setup PHP Symlink to 8.3', 0)
|
||||
|
||||
Upgrade.stdOut("PHP symlink created successfully.")
|
||||
Upgrade.stdOut("PHP symlink updated to PHP 8.3 successfully.")
|
||||
|
||||
except BaseException as msg:
|
||||
Upgrade.stdOut('[ERROR] ' + str(msg) + " [setupPHPSymlink]")
|
||||
|
||||
Reference in New Issue
Block a user