feat: convert WordOps from Nginx to OpenLiteSpeed + LSPHP + LSCache
Complete conversion of the WordOps stack from Nginx + PHP-FPM to OpenLiteSpeed + LSPHP + LSCache. This is a full rewrite across all 7 phases of the codebase: - Foundation: OLS paths, variables, services, removed pynginxconfig dep - Templates: 11 new OLS mustache templates, removed nginx-specific ones - Stack: stack_pref, stack, stack_services, stack_upgrade, stack_migrate - Site: site_functions, site, site_create, site_update - Plugins: debug, info, log, clean rewritten for OLS - SSL/ACME: acme.sh deploy uses lswsctrl, OLS vhssl blocks - Other: secure, backup, clone, install script Additional features: - Debian 13 (trixie) support - PHP 8.5 support - WP Fort Knox mu-plugin integration (wo secure --lockdown/--unlock) - --nginx CLI flag preserved for backward compatibility Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -4,7 +4,6 @@ import configparser
|
||||
import os
|
||||
|
||||
from cement.core.controller import CementBaseController, expose
|
||||
from pynginxconfig import NginxConfig
|
||||
|
||||
from wo.core.aptget import WOAptGet
|
||||
from wo.core.logging import Log
|
||||
@@ -21,8 +20,8 @@ class WOInfoController(CementBaseController):
|
||||
label = 'info'
|
||||
stacked_on = 'base'
|
||||
stacked_type = 'nested'
|
||||
description = ('Display configuration information related to Nginx,'
|
||||
' PHP and MySQL')
|
||||
description = ('Display configuration information related to '
|
||||
'OpenLiteSpeed, PHP and MySQL')
|
||||
arguments = [
|
||||
(['--mysql'],
|
||||
dict(help='Get MySQL configuration information',
|
||||
@@ -31,7 +30,7 @@ class WOInfoController(CementBaseController):
|
||||
dict(help='Get PHP configuration information',
|
||||
action='store_true')),
|
||||
(['--nginx'],
|
||||
dict(help='Get Nginx configuration information',
|
||||
dict(help='Get OpenLiteSpeed configuration information',
|
||||
action='store_true')),
|
||||
]
|
||||
usage = "wo info [options]"
|
||||
@@ -41,593 +40,132 @@ class WOInfoController(CementBaseController):
|
||||
action='store_true')))
|
||||
|
||||
@expose(hide=True)
|
||||
def info_nginx(self):
|
||||
"""Display Nginx information"""
|
||||
version = os.popen("/usr/sbin/nginx -v 2>&1 | "
|
||||
"awk -F '/' '{print $2}' | "
|
||||
"awk -F ' ' '{print $1}' | tr '\n' ' '").read()
|
||||
allow = os.popen("grep ^allow /etc/nginx/common/acl.conf | "
|
||||
"cut -d' ' -f2 | cut -d';' -f1 | tr '\n' ' '").read()
|
||||
nc = NginxConfig()
|
||||
nc.loadf('/etc/nginx/nginx.conf')
|
||||
user = nc.get('user')[1]
|
||||
worker_processes = nc.get('worker_processes')[1]
|
||||
worker_connections = nc.get([('events',), 'worker_connections'])[1]
|
||||
keepalive_timeout = nc.get([('http',), 'keepalive_timeout'])[1]
|
||||
fastcgi_read_timeout = nc.get([('http',),
|
||||
'fastcgi_read_timeout'])[1]
|
||||
client_max_body_size = nc.get([('http',),
|
||||
'client_max_body_size'])[1]
|
||||
data = dict(version=version, allow=allow, user=user,
|
||||
worker_processes=worker_processes,
|
||||
def info_ols(self):
|
||||
"""Display OpenLiteSpeed information"""
|
||||
version = os.popen("{0} -v 2>&1 | head -1"
|
||||
.format(WOVar.wo_ols_bin)).read().strip()
|
||||
httpd_conf = '{0}/httpd_config.conf'.format(WOVar.wo_ols_conf_dir)
|
||||
server_name = os.popen("hostname -f 2>/dev/null || hostname"
|
||||
).read().strip()
|
||||
|
||||
# Parse OLS httpd_config.conf for key settings
|
||||
max_connections = ''
|
||||
max_ssl_connections = ''
|
||||
keepalive_timeout = ''
|
||||
gzip_compress = ''
|
||||
brotli_compress = ''
|
||||
quic_enabled = ''
|
||||
|
||||
if os.path.isfile(httpd_conf):
|
||||
with open(httpd_conf, 'r', encoding='utf-8') as f:
|
||||
for line in f:
|
||||
stripped = line.strip()
|
||||
parts = stripped.split(None, 1)
|
||||
if len(parts) == 2:
|
||||
key, val = parts
|
||||
if key == 'maxConnections':
|
||||
max_connections = val
|
||||
elif key == 'maxSSLConnections':
|
||||
max_ssl_connections = val
|
||||
elif key == 'keepAliveTimeout':
|
||||
keepalive_timeout = val
|
||||
elif key == 'enableGzipCompress':
|
||||
gzip_compress = 'On' if val == '1' else 'Off'
|
||||
elif key == 'enableBr':
|
||||
brotli_compress = 'On' if val == '1' else 'Off'
|
||||
elif key == 'enableQuic':
|
||||
quic_enabled = 'On' if val == '1' else 'Off'
|
||||
|
||||
data = dict(version=version, server_name=server_name,
|
||||
max_connections=max_connections,
|
||||
max_ssl_connections=max_ssl_connections,
|
||||
keepalive_timeout=keepalive_timeout,
|
||||
worker_connections=worker_connections,
|
||||
fastcgi_read_timeout=fastcgi_read_timeout,
|
||||
client_max_body_size=client_max_body_size)
|
||||
self.app.render((data), 'info_nginx.mustache')
|
||||
gzip_compress=gzip_compress,
|
||||
brotli_compress=brotli_compress,
|
||||
quic_enabled=quic_enabled)
|
||||
self.app.render((data), 'info_ols.mustache')
|
||||
|
||||
@expose(hide=True)
|
||||
def info_php(self):
|
||||
"""Display PHP information"""
|
||||
pargs = self.app.pargs
|
||||
if WOAptGet.is_installed(self, 'php7.4-fpm'):
|
||||
pargs.php74 = True
|
||||
else:
|
||||
Log.info(self, "PHP 7.4 is not installed")
|
||||
if WOAptGet.is_installed(self, 'php8.0-fpm'):
|
||||
pargs.php80 = True
|
||||
else:
|
||||
Log.info(self, "PHP 8.0 is not installed")
|
||||
if WOAptGet.is_installed(self, 'php8.1-fpm'):
|
||||
pargs.php81 = True
|
||||
else:
|
||||
Log.info(self, "PHP 8.1 is not installed")
|
||||
if WOAptGet.is_installed(self, 'php8.2-fpm'):
|
||||
pargs.php82 = True
|
||||
else:
|
||||
Log.info(self, "PHP 8.2 is not installed")
|
||||
if WOAptGet.is_installed(self, 'php8.3-fpm'):
|
||||
pargs.php83 = True
|
||||
else:
|
||||
Log.info(self, "PHP 8.3 is not installed")
|
||||
if WOAptGet.is_installed(self, 'php8.4-fpm'):
|
||||
pargs.php84 = True
|
||||
else:
|
||||
Log.info(self, "PHP 8.4 is not installed")
|
||||
for parg_version, dot_ver in WOVar.wo_php_versions.items():
|
||||
short_ver = dot_ver.replace('.', '')
|
||||
if WOAptGet.is_installed(self, 'lsphp{0}'.format(short_ver)):
|
||||
setattr(pargs, parg_version, True)
|
||||
else:
|
||||
Log.info(self, "PHP {0} is not installed".format(dot_ver))
|
||||
|
||||
if pargs.php74:
|
||||
self.info_php74()
|
||||
if pargs.php80:
|
||||
self.info_php80()
|
||||
if pargs.php81:
|
||||
self.info_php81()
|
||||
if pargs.php82:
|
||||
self.info_php82()
|
||||
if pargs.php83:
|
||||
self.info_php83()
|
||||
if pargs.php84:
|
||||
self.info_php84()
|
||||
for parg_version, dot_ver in WOVar.wo_php_versions.items():
|
||||
if getattr(pargs, parg_version, False):
|
||||
short_ver = dot_ver.replace('.', '')
|
||||
self._info_lsphp(short_ver, dot_ver)
|
||||
|
||||
@expose(hide=True)
|
||||
def info_php74(self):
|
||||
"""Display PHP information"""
|
||||
version = os.popen("/usr/bin/php7.4 -v 2>/dev/null | "
|
||||
def _info_lsphp(self, short_ver, dot_ver):
|
||||
"""Display LSPHP information for a given version"""
|
||||
php_bin = '/usr/local/lsws/lsphp{0}/bin/php'.format(short_ver)
|
||||
php_ini = ('/usr/local/lsws/lsphp{0}/etc/php/{1}'
|
||||
'/litespeed/php.ini'.format(short_ver, dot_ver))
|
||||
|
||||
version = os.popen("{0} -v 2>/dev/null | "
|
||||
"head -n1 | cut -d' ' -f2 |"
|
||||
" cut -d'+' -f1 | tr -d '\n'").read
|
||||
" cut -d'+' -f1 | tr -d '\\n'"
|
||||
.format(php_bin)).read()
|
||||
|
||||
config = configparser.ConfigParser()
|
||||
config.read('/etc/php/7.4/fpm/php.ini')
|
||||
expose_php = config['PHP']['expose_php']
|
||||
memory_limit = config['PHP']['memory_limit']
|
||||
post_max_size = config['PHP']['post_max_size']
|
||||
upload_max_filesize = config['PHP']['upload_max_filesize']
|
||||
max_execution_time = config['PHP']['max_execution_time']
|
||||
|
||||
if os.path.exists('/etc/php/7.4/fpm/pool.d/www.conf'):
|
||||
config.read('/etc/php/7.4/fpm/pool.d/www.conf')
|
||||
if os.path.isfile(php_ini):
|
||||
config.read(php_ini)
|
||||
else:
|
||||
Log.error(self, 'php-fpm pool config not found')
|
||||
if config.has_section('www'):
|
||||
wconfig = config['www']
|
||||
elif config.has_section('www-php74'):
|
||||
wconfig = config['www-php74']
|
||||
else:
|
||||
Log.error(self, 'Unable to parse configuration')
|
||||
www_listen = wconfig['listen']
|
||||
www_ping_path = wconfig['ping.path']
|
||||
www_pm_status_path = wconfig['pm.status_path']
|
||||
www_pm = wconfig['pm']
|
||||
www_pm_max_requests = wconfig['pm.max_requests']
|
||||
www_pm_max_children = wconfig['pm.max_children']
|
||||
www_pm_start_servers = wconfig['pm.start_servers']
|
||||
www_pm_min_spare_servers = wconfig['pm.min_spare_servers']
|
||||
www_pm_max_spare_servers = wconfig['pm.max_spare_servers']
|
||||
www_request_terminate_time = (wconfig
|
||||
['request_terminate_timeout'])
|
||||
try:
|
||||
www_xdebug = (wconfig
|
||||
['php_admin_flag[xdebug.profiler_enable'
|
||||
'_trigger]'])
|
||||
except Exception as e:
|
||||
Log.debug(self, "{0}".format(e))
|
||||
www_xdebug = 'off'
|
||||
Log.info(self, "LSPHP {0} php.ini not found at {1}"
|
||||
.format(dot_ver, php_ini))
|
||||
return
|
||||
|
||||
config.read('/etc/php/7.4/fpm/pool.d/debug.conf')
|
||||
debug_listen = config['debug']['listen']
|
||||
debug_ping_path = config['debug']['ping.path']
|
||||
debug_pm_status_path = config['debug']['pm.status_path']
|
||||
debug_pm = config['debug']['pm']
|
||||
debug_pm_max_requests = config['debug']['pm.max_requests']
|
||||
debug_pm_max_children = config['debug']['pm.max_children']
|
||||
debug_pm_start_servers = config['debug']['pm.start_servers']
|
||||
debug_pm_min_spare_servers = config['debug']['pm.min_spare_servers']
|
||||
debug_pm_max_spare_servers = config['debug']['pm.max_spare_servers']
|
||||
debug_request_terminate = (config['debug']
|
||||
['request_terminate_timeout'])
|
||||
try:
|
||||
debug_xdebug = (config['debug']['php_admin_flag[xdebug.profiler_'
|
||||
'enable_trigger]'])
|
||||
except Exception as e:
|
||||
Log.debug(self, "{0}".format(e))
|
||||
debug_xdebug = 'off'
|
||||
expose_php = config['PHP']['expose_php']
|
||||
except KeyError:
|
||||
expose_php = 'N/A'
|
||||
try:
|
||||
memory_limit = config['PHP']['memory_limit']
|
||||
except KeyError:
|
||||
memory_limit = 'N/A'
|
||||
try:
|
||||
post_max_size = config['PHP']['post_max_size']
|
||||
except KeyError:
|
||||
post_max_size = 'N/A'
|
||||
try:
|
||||
upload_max_filesize = config['PHP']['upload_max_filesize']
|
||||
except KeyError:
|
||||
upload_max_filesize = 'N/A'
|
||||
try:
|
||||
max_execution_time = config['PHP']['max_execution_time']
|
||||
except KeyError:
|
||||
max_execution_time = 'N/A'
|
||||
|
||||
data = dict(version=version, expose_php=expose_php,
|
||||
memory_limit=memory_limit, post_max_size=post_max_size,
|
||||
upload_max_filesize=upload_max_filesize,
|
||||
max_execution_time=max_execution_time,
|
||||
www_listen=www_listen, www_ping_path=www_ping_path,
|
||||
www_pm_status_path=www_pm_status_path, www_pm=www_pm,
|
||||
www_pm_max_requests=www_pm_max_requests,
|
||||
www_pm_max_children=www_pm_max_children,
|
||||
www_pm_start_servers=www_pm_start_servers,
|
||||
www_pm_min_spare_servers=www_pm_min_spare_servers,
|
||||
www_pm_max_spare_servers=www_pm_max_spare_servers,
|
||||
www_request_terminate_timeout=www_request_terminate_time,
|
||||
www_xdebug_profiler_enable_trigger=www_xdebug,
|
||||
debug_listen=debug_listen, debug_ping_path=debug_ping_path,
|
||||
debug_pm_status_path=debug_pm_status_path,
|
||||
debug_pm=debug_pm,
|
||||
debug_pm_max_requests=debug_pm_max_requests,
|
||||
debug_pm_max_children=debug_pm_max_children,
|
||||
debug_pm_start_servers=debug_pm_start_servers,
|
||||
debug_pm_min_spare_servers=debug_pm_min_spare_servers,
|
||||
debug_pm_max_spare_servers=debug_pm_max_spare_servers,
|
||||
debug_request_terminate_timeout=debug_request_terminate,
|
||||
debug_xdebug_profiler_enable_trigger=debug_xdebug)
|
||||
self.app.render((data), 'info_php.mustache')
|
||||
|
||||
@expose(hide=True)
|
||||
def info_php80(self):
|
||||
"""Display PHP information"""
|
||||
version = os.popen("/usr/bin/php8.0 -v 2>/dev/null | "
|
||||
"head -n1 | cut -d' ' -f2 |"
|
||||
" cut -d'+' -f1 | tr -d '\n'").read
|
||||
config = configparser.ConfigParser()
|
||||
config.read('/etc/php/8.0/fpm/php.ini')
|
||||
expose_php = config['PHP']['expose_php']
|
||||
memory_limit = config['PHP']['memory_limit']
|
||||
post_max_size = config['PHP']['post_max_size']
|
||||
upload_max_filesize = config['PHP']['upload_max_filesize']
|
||||
max_execution_time = config['PHP']['max_execution_time']
|
||||
|
||||
if os.path.exists('/etc/php/8.0/fpm/pool.d/www.conf'):
|
||||
config.read('/etc/php/8.0/fpm/pool.d/www.conf')
|
||||
else:
|
||||
Log.error(self, 'php-fpm pool config not found')
|
||||
if config.has_section('www'):
|
||||
wconfig = config['www']
|
||||
elif config.has_section('www-php80'):
|
||||
wconfig = config['www-php80']
|
||||
else:
|
||||
Log.error(self, 'Unable to parse configuration')
|
||||
www_listen = wconfig['listen']
|
||||
www_ping_path = wconfig['ping.path']
|
||||
www_pm_status_path = wconfig['pm.status_path']
|
||||
www_pm = wconfig['pm']
|
||||
www_pm_max_requests = wconfig['pm.max_requests']
|
||||
www_pm_max_children = wconfig['pm.max_children']
|
||||
www_pm_start_servers = wconfig['pm.start_servers']
|
||||
www_pm_min_spare_servers = wconfig['pm.min_spare_servers']
|
||||
www_pm_max_spare_servers = wconfig['pm.max_spare_servers']
|
||||
www_request_terminate_time = (wconfig
|
||||
['request_terminate_timeout'])
|
||||
try:
|
||||
www_xdebug = (wconfig
|
||||
['php_admin_flag[xdebug.profiler_enable'
|
||||
'_trigger]'])
|
||||
except Exception as e:
|
||||
Log.debug(self, "{0}".format(e))
|
||||
www_xdebug = 'off'
|
||||
|
||||
config.read('/etc/php/8.0/fpm/pool.d/debug.conf')
|
||||
debug_listen = config['debug']['listen']
|
||||
debug_ping_path = config['debug']['ping.path']
|
||||
debug_pm_status_path = config['debug']['pm.status_path']
|
||||
debug_pm = config['debug']['pm']
|
||||
debug_pm_max_requests = config['debug']['pm.max_requests']
|
||||
debug_pm_max_children = config['debug']['pm.max_children']
|
||||
debug_pm_start_servers = config['debug']['pm.start_servers']
|
||||
debug_pm_min_spare_servers = config['debug']['pm.min_spare_servers']
|
||||
debug_pm_max_spare_servers = config['debug']['pm.max_spare_servers']
|
||||
debug_request_terminate = (config['debug']
|
||||
['request_terminate_timeout'])
|
||||
try:
|
||||
debug_xdebug = (config['debug']['php_admin_flag[xdebug.profiler_'
|
||||
'enable_trigger]'])
|
||||
except Exception as e:
|
||||
Log.debug(self, "{0}".format(e))
|
||||
debug_xdebug = 'off'
|
||||
|
||||
data = dict(version=version, expose_php=expose_php,
|
||||
memory_limit=memory_limit, post_max_size=post_max_size,
|
||||
upload_max_filesize=upload_max_filesize,
|
||||
max_execution_time=max_execution_time,
|
||||
www_listen=www_listen, www_ping_path=www_ping_path,
|
||||
www_pm_status_path=www_pm_status_path, www_pm=www_pm,
|
||||
www_pm_max_requests=www_pm_max_requests,
|
||||
www_pm_max_children=www_pm_max_children,
|
||||
www_pm_start_servers=www_pm_start_servers,
|
||||
www_pm_min_spare_servers=www_pm_min_spare_servers,
|
||||
www_pm_max_spare_servers=www_pm_max_spare_servers,
|
||||
www_request_terminate_timeout=www_request_terminate_time,
|
||||
www_xdebug_profiler_enable_trigger=www_xdebug,
|
||||
debug_listen=debug_listen, debug_ping_path=debug_ping_path,
|
||||
debug_pm_status_path=debug_pm_status_path,
|
||||
debug_pm=debug_pm,
|
||||
debug_pm_max_requests=debug_pm_max_requests,
|
||||
debug_pm_max_children=debug_pm_max_children,
|
||||
debug_pm_start_servers=debug_pm_start_servers,
|
||||
debug_pm_min_spare_servers=debug_pm_min_spare_servers,
|
||||
debug_pm_max_spare_servers=debug_pm_max_spare_servers,
|
||||
debug_request_terminate_timeout=debug_request_terminate,
|
||||
debug_xdebug_profiler_enable_trigger=debug_xdebug)
|
||||
self.app.render((data), 'info_php.mustache')
|
||||
|
||||
@expose(hide=True)
|
||||
def info_php81(self):
|
||||
"""Display PHP information"""
|
||||
version = os.popen("/usr/bin/php8.1 -v 2>/dev/null | "
|
||||
"head -n1 | cut -d' ' -f2 |"
|
||||
" cut -d'+' -f1 | tr -d '\n'").read
|
||||
config = configparser.ConfigParser()
|
||||
config.read('/etc/php/8.1/fpm/php.ini')
|
||||
expose_php = config['PHP']['expose_php']
|
||||
memory_limit = config['PHP']['memory_limit']
|
||||
post_max_size = config['PHP']['post_max_size']
|
||||
upload_max_filesize = config['PHP']['upload_max_filesize']
|
||||
max_execution_time = config['PHP']['max_execution_time']
|
||||
|
||||
if os.path.exists('/etc/php/8.1/fpm/pool.d/www.conf'):
|
||||
config.read('/etc/php/8.1/fpm/pool.d/www.conf')
|
||||
else:
|
||||
Log.error(self, 'php-fpm pool config not found')
|
||||
if config.has_section('www'):
|
||||
wconfig = config['www']
|
||||
elif config.has_section('www-php81'):
|
||||
wconfig = config['www-php81']
|
||||
else:
|
||||
Log.error(self, 'Unable to parse configuration')
|
||||
www_listen = wconfig['listen']
|
||||
www_ping_path = wconfig['ping.path']
|
||||
www_pm_status_path = wconfig['pm.status_path']
|
||||
www_pm = wconfig['pm']
|
||||
www_pm_max_requests = wconfig['pm.max_requests']
|
||||
www_pm_max_children = wconfig['pm.max_children']
|
||||
www_pm_start_servers = wconfig['pm.start_servers']
|
||||
www_pm_min_spare_servers = wconfig['pm.min_spare_servers']
|
||||
www_pm_max_spare_servers = wconfig['pm.max_spare_servers']
|
||||
www_request_terminate_time = (wconfig
|
||||
['request_terminate_timeout'])
|
||||
try:
|
||||
www_xdebug = (wconfig
|
||||
['php_admin_flag[xdebug.profiler_enable'
|
||||
'_trigger]'])
|
||||
except Exception as e:
|
||||
Log.debug(self, "{0}".format(e))
|
||||
www_xdebug = 'off'
|
||||
|
||||
config.read('/etc/php/8.1/fpm/pool.d/debug.conf')
|
||||
debug_listen = config['debug']['listen']
|
||||
debug_ping_path = config['debug']['ping.path']
|
||||
debug_pm_status_path = config['debug']['pm.status_path']
|
||||
debug_pm = config['debug']['pm']
|
||||
debug_pm_max_requests = config['debug']['pm.max_requests']
|
||||
debug_pm_max_children = config['debug']['pm.max_children']
|
||||
debug_pm_start_servers = config['debug']['pm.start_servers']
|
||||
debug_pm_min_spare_servers = config['debug']['pm.min_spare_servers']
|
||||
debug_pm_max_spare_servers = config['debug']['pm.max_spare_servers']
|
||||
debug_request_terminate = (config['debug']
|
||||
['request_terminate_timeout'])
|
||||
try:
|
||||
debug_xdebug = (config['debug']['php_admin_flag[xdebug.profiler_'
|
||||
'enable_trigger]'])
|
||||
except Exception as e:
|
||||
Log.debug(self, "{0}".format(e))
|
||||
debug_xdebug = 'off'
|
||||
|
||||
data = dict(version=version, expose_php=expose_php,
|
||||
memory_limit=memory_limit, post_max_size=post_max_size,
|
||||
upload_max_filesize=upload_max_filesize,
|
||||
max_execution_time=max_execution_time,
|
||||
www_listen=www_listen, www_ping_path=www_ping_path,
|
||||
www_pm_status_path=www_pm_status_path, www_pm=www_pm,
|
||||
www_pm_max_requests=www_pm_max_requests,
|
||||
www_pm_max_children=www_pm_max_children,
|
||||
www_pm_start_servers=www_pm_start_servers,
|
||||
www_pm_min_spare_servers=www_pm_min_spare_servers,
|
||||
www_pm_max_spare_servers=www_pm_max_spare_servers,
|
||||
www_request_terminate_timeout=www_request_terminate_time,
|
||||
www_xdebug_profiler_enable_trigger=www_xdebug,
|
||||
debug_listen=debug_listen, debug_ping_path=debug_ping_path,
|
||||
debug_pm_status_path=debug_pm_status_path,
|
||||
debug_pm=debug_pm,
|
||||
debug_pm_max_requests=debug_pm_max_requests,
|
||||
debug_pm_max_children=debug_pm_max_children,
|
||||
debug_pm_start_servers=debug_pm_start_servers,
|
||||
debug_pm_min_spare_servers=debug_pm_min_spare_servers,
|
||||
debug_pm_max_spare_servers=debug_pm_max_spare_servers,
|
||||
debug_request_terminate_timeout=debug_request_terminate,
|
||||
debug_xdebug_profiler_enable_trigger=debug_xdebug)
|
||||
self.app.render((data), 'info_php.mustache')
|
||||
|
||||
@expose(hide=True)
|
||||
def info_php82(self):
|
||||
"""Display PHP information"""
|
||||
version = os.popen("/usr/bin/php8.2 -v 2>/dev/null | "
|
||||
"head -n1 | cut -d' ' -f2 |"
|
||||
" cut -d'+' -f1 | tr -d '\n'").read
|
||||
config = configparser.ConfigParser()
|
||||
config.read('/etc/php/8.2/fpm/php.ini')
|
||||
expose_php = config['PHP']['expose_php']
|
||||
memory_limit = config['PHP']['memory_limit']
|
||||
post_max_size = config['PHP']['post_max_size']
|
||||
upload_max_filesize = config['PHP']['upload_max_filesize']
|
||||
max_execution_time = config['PHP']['max_execution_time']
|
||||
|
||||
if os.path.exists('/etc/php/8.2/fpm/pool.d/www.conf'):
|
||||
config.read('/etc/php/8.2/fpm/pool.d/www.conf')
|
||||
else:
|
||||
Log.error(self, 'php-fpm pool config not found')
|
||||
if config.has_section('www'):
|
||||
wconfig = config['www']
|
||||
elif config.has_section('www-php82'):
|
||||
wconfig = config['www-php82']
|
||||
else:
|
||||
Log.error(self, 'Unable to parse configuration')
|
||||
www_listen = wconfig['listen']
|
||||
www_ping_path = wconfig['ping.path']
|
||||
www_pm_status_path = wconfig['pm.status_path']
|
||||
www_pm = wconfig['pm']
|
||||
www_pm_max_requests = wconfig['pm.max_requests']
|
||||
www_pm_max_children = wconfig['pm.max_children']
|
||||
www_pm_start_servers = wconfig['pm.start_servers']
|
||||
www_pm_min_spare_servers = wconfig['pm.min_spare_servers']
|
||||
www_pm_max_spare_servers = wconfig['pm.max_spare_servers']
|
||||
www_request_terminate_time = (wconfig
|
||||
['request_terminate_timeout'])
|
||||
try:
|
||||
www_xdebug = (wconfig
|
||||
['php_admin_flag[xdebug.profiler_enable'
|
||||
'_trigger]'])
|
||||
except Exception as e:
|
||||
Log.debug(self, "{0}".format(e))
|
||||
www_xdebug = 'off'
|
||||
|
||||
config.read('/etc/php/8.2/fpm/pool.d/debug.conf')
|
||||
debug_listen = config['debug']['listen']
|
||||
debug_ping_path = config['debug']['ping.path']
|
||||
debug_pm_status_path = config['debug']['pm.status_path']
|
||||
debug_pm = config['debug']['pm']
|
||||
debug_pm_max_requests = config['debug']['pm.max_requests']
|
||||
debug_pm_max_children = config['debug']['pm.max_children']
|
||||
debug_pm_start_servers = config['debug']['pm.start_servers']
|
||||
debug_pm_min_spare_servers = config['debug']['pm.min_spare_servers']
|
||||
debug_pm_max_spare_servers = config['debug']['pm.max_spare_servers']
|
||||
debug_request_terminate = (config['debug']
|
||||
['request_terminate_timeout'])
|
||||
try:
|
||||
debug_xdebug = (config['debug']['php_admin_flag[xdebug.profiler_'
|
||||
'enable_trigger]'])
|
||||
except Exception as e:
|
||||
Log.debug(self, "{0}".format(e))
|
||||
debug_xdebug = 'off'
|
||||
|
||||
data = dict(version=version, expose_php=expose_php,
|
||||
memory_limit=memory_limit, post_max_size=post_max_size,
|
||||
upload_max_filesize=upload_max_filesize,
|
||||
max_execution_time=max_execution_time,
|
||||
www_listen=www_listen, www_ping_path=www_ping_path,
|
||||
www_pm_status_path=www_pm_status_path, www_pm=www_pm,
|
||||
www_pm_max_requests=www_pm_max_requests,
|
||||
www_pm_max_children=www_pm_max_children,
|
||||
www_pm_start_servers=www_pm_start_servers,
|
||||
www_pm_min_spare_servers=www_pm_min_spare_servers,
|
||||
www_pm_max_spare_servers=www_pm_max_spare_servers,
|
||||
www_request_terminate_timeout=www_request_terminate_time,
|
||||
www_xdebug_profiler_enable_trigger=www_xdebug,
|
||||
debug_listen=debug_listen, debug_ping_path=debug_ping_path,
|
||||
debug_pm_status_path=debug_pm_status_path,
|
||||
debug_pm=debug_pm,
|
||||
debug_pm_max_requests=debug_pm_max_requests,
|
||||
debug_pm_max_children=debug_pm_max_children,
|
||||
debug_pm_start_servers=debug_pm_start_servers,
|
||||
debug_pm_min_spare_servers=debug_pm_min_spare_servers,
|
||||
debug_pm_max_spare_servers=debug_pm_max_spare_servers,
|
||||
debug_request_terminate_timeout=debug_request_terminate,
|
||||
debug_xdebug_profiler_enable_trigger=debug_xdebug)
|
||||
self.app.render((data), 'info_php.mustache')
|
||||
|
||||
@expose(hide=True)
|
||||
def info_php83(self):
|
||||
"""Display PHP information"""
|
||||
version = os.popen("/usr/bin/php8.3 -v 2>/dev/null | "
|
||||
"head -n1 | cut -d' ' -f2 |"
|
||||
" cut -d'+' -f1 | tr -d '\n'").read
|
||||
config = configparser.ConfigParser()
|
||||
config.read('/etc/php/8.3/fpm/php.ini')
|
||||
expose_php = config['PHP']['expose_php']
|
||||
memory_limit = config['PHP']['memory_limit']
|
||||
post_max_size = config['PHP']['post_max_size']
|
||||
upload_max_filesize = config['PHP']['upload_max_filesize']
|
||||
max_execution_time = config['PHP']['max_execution_time']
|
||||
|
||||
if os.path.exists('/etc/php/8.3/fpm/pool.d/www.conf'):
|
||||
config.read('/etc/php/8.3/fpm/pool.d/www.conf')
|
||||
else:
|
||||
Log.error(self, 'php-fpm pool config not found')
|
||||
if config.has_section('www'):
|
||||
wconfig = config['www']
|
||||
elif config.has_section('www-php83'):
|
||||
wconfig = config['www-php83']
|
||||
else:
|
||||
Log.error(self, 'Unable to parse configuration')
|
||||
www_listen = wconfig['listen']
|
||||
www_ping_path = wconfig['ping.path']
|
||||
www_pm_status_path = wconfig['pm.status_path']
|
||||
www_pm = wconfig['pm']
|
||||
www_pm_max_requests = wconfig['pm.max_requests']
|
||||
www_pm_max_children = wconfig['pm.max_children']
|
||||
www_pm_start_servers = wconfig['pm.start_servers']
|
||||
www_pm_min_spare_servers = wconfig['pm.min_spare_servers']
|
||||
www_pm_max_spare_servers = wconfig['pm.max_spare_servers']
|
||||
www_request_terminate_time = (wconfig
|
||||
['request_terminate_timeout'])
|
||||
try:
|
||||
www_xdebug = (wconfig
|
||||
['php_admin_flag[xdebug.profiler_enable'
|
||||
'_trigger]'])
|
||||
except Exception as e:
|
||||
Log.debug(self, "{0}".format(e))
|
||||
www_xdebug = 'off'
|
||||
|
||||
config.read('/etc/php/8.3/fpm/pool.d/debug.conf')
|
||||
debug_listen = config['debug']['listen']
|
||||
debug_ping_path = config['debug']['ping.path']
|
||||
debug_pm_status_path = config['debug']['pm.status_path']
|
||||
debug_pm = config['debug']['pm']
|
||||
debug_pm_max_requests = config['debug']['pm.max_requests']
|
||||
debug_pm_max_children = config['debug']['pm.max_children']
|
||||
debug_pm_start_servers = config['debug']['pm.start_servers']
|
||||
debug_pm_min_spare_servers = config['debug']['pm.min_spare_servers']
|
||||
debug_pm_max_spare_servers = config['debug']['pm.max_spare_servers']
|
||||
debug_request_terminate = (config['debug']
|
||||
['request_terminate_timeout'])
|
||||
try:
|
||||
debug_xdebug = (config['debug']['php_admin_flag[xdebug.profiler_'
|
||||
'enable_trigger]'])
|
||||
except Exception as e:
|
||||
Log.debug(self, "{0}".format(e))
|
||||
debug_xdebug = 'off'
|
||||
|
||||
data = dict(version=version, expose_php=expose_php,
|
||||
memory_limit=memory_limit, post_max_size=post_max_size,
|
||||
upload_max_filesize=upload_max_filesize,
|
||||
max_execution_time=max_execution_time,
|
||||
www_listen=www_listen, www_ping_path=www_ping_path,
|
||||
www_pm_status_path=www_pm_status_path, www_pm=www_pm,
|
||||
www_pm_max_requests=www_pm_max_requests,
|
||||
www_pm_max_children=www_pm_max_children,
|
||||
www_pm_start_servers=www_pm_start_servers,
|
||||
www_pm_min_spare_servers=www_pm_min_spare_servers,
|
||||
www_pm_max_spare_servers=www_pm_max_spare_servers,
|
||||
www_request_terminate_timeout=www_request_terminate_time,
|
||||
www_xdebug_profiler_enable_trigger=www_xdebug,
|
||||
debug_listen=debug_listen, debug_ping_path=debug_ping_path,
|
||||
debug_pm_status_path=debug_pm_status_path,
|
||||
debug_pm=debug_pm,
|
||||
debug_pm_max_requests=debug_pm_max_requests,
|
||||
debug_pm_max_children=debug_pm_max_children,
|
||||
debug_pm_start_servers=debug_pm_start_servers,
|
||||
debug_pm_min_spare_servers=debug_pm_min_spare_servers,
|
||||
debug_pm_max_spare_servers=debug_pm_max_spare_servers,
|
||||
debug_request_terminate_timeout=debug_request_terminate,
|
||||
debug_xdebug_profiler_enable_trigger=debug_xdebug)
|
||||
self.app.render((data), 'info_php.mustache')
|
||||
|
||||
@expose(hide=True)
|
||||
def info_php84(self):
|
||||
"""Display PHP information"""
|
||||
version = os.popen("/usr/bin/php8.4 -v 2>/dev/null | "
|
||||
"head -n1 | cut -d' ' -f2 |"
|
||||
" cut -d'+' -f1 | tr -d '\n'").read
|
||||
config = configparser.ConfigParser()
|
||||
config.read('/etc/php/8.4/fpm/php.ini')
|
||||
expose_php = config['PHP']['expose_php']
|
||||
memory_limit = config['PHP']['memory_limit']
|
||||
post_max_size = config['PHP']['post_max_size']
|
||||
upload_max_filesize = config['PHP']['upload_max_filesize']
|
||||
max_execution_time = config['PHP']['max_execution_time']
|
||||
|
||||
if os.path.exists('/etc/php/8.4/fpm/pool.d/www.conf'):
|
||||
config.read('/etc/php/8.4/fpm/pool.d/www.conf')
|
||||
else:
|
||||
Log.error(self, 'php-fpm pool config not found')
|
||||
if config.has_section('www'):
|
||||
wconfig = config['www']
|
||||
elif config.has_section('www-php84'):
|
||||
wconfig = config['www-php84']
|
||||
else:
|
||||
Log.error(self, 'Unable to parse configuration')
|
||||
www_listen = wconfig['listen']
|
||||
www_ping_path = wconfig['ping.path']
|
||||
www_pm_status_path = wconfig['pm.status_path']
|
||||
www_pm = wconfig['pm']
|
||||
www_pm_max_requests = wconfig['pm.max_requests']
|
||||
www_pm_max_children = wconfig['pm.max_children']
|
||||
www_pm_start_servers = wconfig['pm.start_servers']
|
||||
www_pm_min_spare_servers = wconfig['pm.min_spare_servers']
|
||||
www_pm_max_spare_servers = wconfig['pm.max_spare_servers']
|
||||
www_request_terminate_time = (wconfig
|
||||
['request_terminate_timeout'])
|
||||
try:
|
||||
www_xdebug = (wconfig
|
||||
['php_admin_flag[xdebug.profiler_enable'
|
||||
'_trigger]'])
|
||||
except Exception as e:
|
||||
Log.debug(self, "{0}".format(e))
|
||||
www_xdebug = 'off'
|
||||
|
||||
config.read('/etc/php/8.4/fpm/pool.d/debug.conf')
|
||||
debug_listen = config['debug']['listen']
|
||||
debug_ping_path = config['debug']['ping.path']
|
||||
debug_pm_status_path = config['debug']['pm.status_path']
|
||||
debug_pm = config['debug']['pm']
|
||||
debug_pm_max_requests = config['debug']['pm.max_requests']
|
||||
debug_pm_max_children = config['debug']['pm.max_children']
|
||||
debug_pm_start_servers = config['debug']['pm.start_servers']
|
||||
debug_pm_min_spare_servers = config['debug']['pm.min_spare_servers']
|
||||
debug_pm_max_spare_servers = config['debug']['pm.max_spare_servers']
|
||||
debug_request_terminate = (config['debug']
|
||||
['request_terminate_timeout'])
|
||||
try:
|
||||
debug_xdebug = (config['debug']['php_admin_flag[xdebug.profiler_'
|
||||
'enable_trigger]'])
|
||||
except Exception as e:
|
||||
Log.debug(self, "{0}".format(e))
|
||||
debug_xdebug = 'off'
|
||||
|
||||
data = dict(version=version, expose_php=expose_php,
|
||||
memory_limit=memory_limit, post_max_size=post_max_size,
|
||||
upload_max_filesize=upload_max_filesize,
|
||||
max_execution_time=max_execution_time,
|
||||
www_listen=www_listen, www_ping_path=www_ping_path,
|
||||
www_pm_status_path=www_pm_status_path, www_pm=www_pm,
|
||||
www_pm_max_requests=www_pm_max_requests,
|
||||
www_pm_max_children=www_pm_max_children,
|
||||
www_pm_start_servers=www_pm_start_servers,
|
||||
www_pm_min_spare_servers=www_pm_min_spare_servers,
|
||||
www_pm_max_spare_servers=www_pm_max_spare_servers,
|
||||
www_request_terminate_timeout=www_request_terminate_time,
|
||||
www_xdebug_profiler_enable_trigger=www_xdebug,
|
||||
debug_listen=debug_listen, debug_ping_path=debug_ping_path,
|
||||
debug_pm_status_path=debug_pm_status_path,
|
||||
debug_pm=debug_pm,
|
||||
debug_pm_max_requests=debug_pm_max_requests,
|
||||
debug_pm_max_children=debug_pm_max_children,
|
||||
debug_pm_start_servers=debug_pm_start_servers,
|
||||
debug_pm_min_spare_servers=debug_pm_min_spare_servers,
|
||||
debug_pm_max_spare_servers=debug_pm_max_spare_servers,
|
||||
debug_request_terminate_timeout=debug_request_terminate,
|
||||
debug_xdebug_profiler_enable_trigger=debug_xdebug)
|
||||
www_listen='LSAPI (managed by OLS)',
|
||||
www_ping_path='N/A',
|
||||
www_pm_status_path='N/A', www_pm='N/A',
|
||||
www_pm_max_requests='N/A',
|
||||
www_pm_max_children='N/A',
|
||||
www_pm_start_servers='N/A',
|
||||
www_pm_min_spare_servers='N/A',
|
||||
www_pm_max_spare_servers='N/A',
|
||||
www_request_terminate_timeout='N/A',
|
||||
www_xdebug_profiler_enable_trigger='N/A',
|
||||
debug_listen='N/A', debug_ping_path='N/A',
|
||||
debug_pm_status_path='N/A',
|
||||
debug_pm='N/A',
|
||||
debug_pm_max_requests='N/A',
|
||||
debug_pm_max_children='N/A',
|
||||
debug_pm_start_servers='N/A',
|
||||
debug_pm_min_spare_servers='N/A',
|
||||
debug_pm_max_spare_servers='N/A',
|
||||
debug_request_terminate_timeout='N/A',
|
||||
debug_xdebug_profiler_enable_trigger='N/A')
|
||||
self.app.render((data), 'info_php.mustache')
|
||||
|
||||
@expose(hide=True)
|
||||
@@ -673,19 +211,17 @@ class WOInfoController(CementBaseController):
|
||||
def default(self):
|
||||
"""default function for info"""
|
||||
pargs = self.app.pargs
|
||||
if (not pargs.nginx and not pargs.php and
|
||||
not pargs.mysql and not pargs.php74 and not pargs.php80 and
|
||||
not pargs.php81 and not pargs.php82 and not pargs.php83):
|
||||
if (not pargs.nginx and not pargs.php and not pargs.mysql):
|
||||
pargs.nginx = True
|
||||
pargs.mysql = True
|
||||
pargs.php = True
|
||||
|
||||
if pargs.nginx:
|
||||
if ((not WOAptGet.is_installed(self, 'nginx-custom')) and
|
||||
(not os.path.exists('/usr/bin/nginx'))):
|
||||
Log.info(self, "Nginx is not installed")
|
||||
if ((not WOAptGet.is_installed(self, 'openlitespeed')) and
|
||||
(not os.path.exists(WOVar.wo_ols_bin))):
|
||||
Log.info(self, "OpenLiteSpeed is not installed")
|
||||
else:
|
||||
self.info_nginx()
|
||||
self.info_ols()
|
||||
|
||||
if pargs.php:
|
||||
self.info_php()
|
||||
|
||||
Reference in New Issue
Block a user