Linux evo.fastest-server.com 5.14.0-284.1101.el9.tuxcare.11.els11.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Aug 14 13:30:35 UTC 2026 x86_64
LiteSpeed
Server IP : 103.249.112.113 & Your IP : 216.73.217.135
Domains : 988 Domain
User : tanishks
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
usr /
share /
l.v.e-manager /
hooks /
plesk /
Delete
Unzip
Name
Size
Permission
Date
Action
PHP_settings_update.py
5.91
KB
-rwxr-xr-x
2026-08-11 11:38
Save
Rename
#!/opt/cloudlinux/venv/bin/python3 -bb # -*- coding: utf-8 -*- # # Copyright © Cloud Linux GmbH & Cloud Linux Software, Inc 2010-2019 All Rights Reserved # # Licensed under CLOUD LINUX LICENSE AGREEMENT # http://cloudlinux.com/docs/LICENSE.TXT # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above # copyright notice, this list of conditions and the following # disclaimer in the documentation and/or other materials provided # with the distribution. # * The names of its contributors may not be used to endorse or # promote products derived from this software without specific # prior written permission. # #THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS #"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT #LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS #FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE #COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, #INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, #BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; #LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER #CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT #LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN #ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE #POSSIBILITY OF SUCH DAMAGE. # from __future__ import print_function from __future__ import division from __future__ import absolute_import import re import sys import os import shutil import subprocess import cldetectlib import clcommon.cpapi from clcommon import ClPwd, mysql_lib def print_error_and_exit(*args): """ Print error and exit :param args: :return: """ print("Error:", end=' ', file=sys.stderr) for a in args: print(a, end=' ', file=sys.stderr) print(file=sys.stderr) sys.exit(1) def get_user_prefix(username): """ Get user prefix :param username: User name :return: User's prefix """ try: clpwd = ClPwd() uid = clpwd.get_uid(username) except ClPwd.NoSuchUserException: print_error_and_exit('user %s not found' % username) b = uid % 100 prefix = "%02d" % b return prefix def exec_cagefsctl(cagefsctl_args): """ Executes cagefsctl with supplied arguments :param cagefsctl_args: cagefsctl arguments :return: None """ args = list() args.append('/usr/sbin/cagefsctl') args.extend(cagefsctl_args) process = subprocess.Popen(args) process.communicate() retcode = process.returncode if retcode != 0: # cagefsctl error sys.exit(1) def _sync_nginx_serve_php(domain_name): """ If the domain is PHP Selector compatible, disable nginxServePhp so Nginx proxies PHP to Apache instead of trying to serve it directly via a non-existent FPM socket. Runs plesk_nginx_php_sync.py as a subprocess. See: CLOS-3894 """ sync_script = '/usr/share/l.v.e-manager/utils/plesk_nginx_php_sync.py' if not os.path.exists(sync_script): return try: subprocess.check_call( [sys.executable, sync_script, '--domain', domain_name], timeout=60, ) except Exception as e: print("Warning: could not sync nginxServePhp for %s: %s" % (domain_name, e), file=sys.stderr) def get_user_by_domain(domain_name): """ Retrieves user name by domain from Plesk DB :param domain_name: Domain name :return: User name """ # Get Plesk DB access db_access = clcommon.cpapi.db_access() db_name = "psa" s_query = "SELECT su.login FROM sys_users su, hosting h, domains d, domains sd " \ "WHERE h.sys_user_id=su.id AND h.dom_id=d.id AND (d.name=%s OR d.id=sd.webspace_id AND " \ "sd.name=%s) LIMIT 1" connector = mysql_lib.MySQLConnector(host='localhost', user=db_access['login'], passwd=db_access['pass'], db=db_name) with connector.connect() as db: data = db.execute_query(s_query, (domain_name, domain_name)) try: return data[0][0] except IndexError: print_error_and_exit("No domain '%s' found in Plesk DB" % domain_name) def main(): # Only for Plesk 12.5+ if not cldetectlib.is_plesk(): return if len(sys.argv) != 2: print_error_and_exit("Invalid arguments in call") domain_name = sys.argv[1] if not re.match(r'^[a-zA-Z0-9][a-zA-Z0-9.\-]{0,253}[a-zA-Z0-9]$', domain_name): print_error_and_exit("Invalid domain name") username = get_user_by_domain(domain_name) # Terminate if CageFs absent if not os.path.exists('/usr/share/cagefs-skeleton/bin'): # CageFs not installed or not initialized print("Warning: CageFs is absent, can't restore alt-php settings") sys.exit(0) # Determine user's prefix user_prefix = get_user_prefix(username) try: # 1. Remove existing dirs, if they present dir_name = '/var/cagefs/%s/%s/etc/cl.selector' % (str(user_prefix), username) shutil.rmtree(dir_name, ignore_errors=True) dir_name = '/var/cagefs/%s/%s/etc/cl.php.d' % (str(user_prefix), username) shutil.rmtree(dir_name, ignore_errors=True) # 2. Call cagefsctl to restore alt-php settings exec_cagefsctl(['--force-update-etc', username]) exec_cagefsctl(['--rebuild-alt-php-ini', username]) except Exception as e: print_error_and_exit("Error: " + str(e)) # 3. Ensure nginxServePhp=false if domain uses CGI/FastCGI (CLOS-3894) _sync_nginx_serve_php(domain_name) # successful end sys.exit(0) if __name__ == "__main__": main()