diff --git a/managePHP/phpManager.py b/managePHP/phpManager.py index f377d9ef0..b22b33780 100755 --- a/managePHP/phpManager.py +++ b/managePHP/phpManager.py @@ -73,7 +73,7 @@ class PHPManager: upload_max_filesize = "" max_input_time = "" - command = "sudo cat " + PHPManager.FindPHPFPMPath(phpVersion) + command = "cat " + PHPManager.FindPHPFPMPath(phpVersion) data = ProcessUtilities.outputExecutioner(command).split('\n') diff --git a/plogical/vhost.py b/plogical/vhost.py index f6b7c5868..ee0828cb1 100755 --- a/plogical/vhost.py +++ b/plogical/vhost.py @@ -570,34 +570,45 @@ class vhost: return [0, str(msg) + " [IO Error with per host config file [changePHP]"] else: try: - data = open(vhFile, "r").readlines() + if not os.path.exists(vhost.redisConf): + data = open(vhFile, "r").readlines() - php = PHPManager.getPHPString(phpVersion) + php = PHPManager.getPHPString(phpVersion) - if not os.path.exists("/usr/local/lsws/lsphp" + str(php) + "/bin/lsphp"): - print(0, 'This PHP version is not available on your CyberPanel.') - return [0, "[This PHP version is not available on your CyberPanel. [changePHP]"] + if not os.path.exists("/usr/local/lsws/lsphp" + str(php) + "/bin/lsphp"): + print(0, 'This PHP version is not available on your CyberPanel.') + return [0, "[This PHP version is not available on your CyberPanel. [changePHP]"] - writeDataToFile = open(vhFile, "w") + writeDataToFile = open(vhFile, "w") - finalString = ' AddHandler application/x-httpd-php' + str(php) + ' .php\n' + finalString = ' AddHandler application/x-httpd-php' + str(php) + ' .php\n' - for items in data: - if items.find("AddHandler application/x-httpd") > -1: - writeDataToFile.writelines(finalString) - else: - writeDataToFile.writelines(items) + for items in data: + if items.find("AddHandler application/x-httpd") > -1: + writeDataToFile.writelines(finalString) + else: + writeDataToFile.writelines(items) - writeDataToFile.close() + writeDataToFile.close() - writeToFile = open(phpDetachUpdatePath, 'w') - writeToFile.close() + writeToFile = open(phpDetachUpdatePath, 'w') + writeToFile.close() + + installUtilities.installUtilities.reStartLiteSpeed() + try: + os.remove(phpDetachUpdatePath) + except: + pass + else: + command = 'redis-cli get "vhost:%s"' % (vhFile.split('/')[-2]) + configData = ProcessUtilities.outputExecutioner(command) + + import re + configData = re.sub(r'"phpVersion": .*,', '"phpVersion": %s,' % (phpVersion.lstrip('PHP ')), configData) + + command = "redis-cli set vhost:%s '%s'" % (vhFile.split('/')[-2], configData) + ProcessUtilities.executioner(command) - installUtilities.installUtilities.reStartLiteSpeed() - try: - os.remove(phpDetachUpdatePath) - except: - pass print("1,None") return 1, 'None' diff --git a/websiteFunctions/website.py b/websiteFunctions/website.py index 97c159c50..ea99d4bb8 100755 --- a/websiteFunctions/website.py +++ b/websiteFunctions/website.py @@ -39,7 +39,6 @@ from plogical.cronUtil import CronUtil from re import match,I,M from plogical import randomPassword from .StagingSetup import StagingSetup -from plogical.vhost import vhost class WebsiteManager: