Add php8.4 support

This commit is contained in:
VirtuBox
2024-12-03 14:08:19 +01:00
parent 104a5a87d2
commit 2f45853067
14 changed files with 218 additions and 31 deletions

View File

@@ -90,6 +90,10 @@ class WOInfoController(CementBaseController):
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")
if pargs.php74:
self.info_php74()
@@ -101,6 +105,8 @@ class WOInfoController(CementBaseController):
self.info_php82()
if pargs.php83:
self.info_php83()
if pargs.php84:
self.info_php84()
@expose(hide=True)
def info_php74(self):
@@ -537,6 +543,93 @@ class WOInfoController(CementBaseController):
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)
self.app.render((data), 'info_php.mustache')
@expose(hide=True)
def info_mysql(self):
"""Display MySQL information"""

View File

@@ -225,7 +225,7 @@ class WOSiteCreateController(CementBaseController):
data['subsiteof_webroot'] = parent_site_info.site_path
if (pargs.php74 or pargs.php80 or pargs.php81 or
pargs.php82 or pargs.php83):
pargs.php82 or pargs.php83 or pargs.php84):
data = dict(
site_name=wo_domain, www_domain=wo_www_domain,
static=False, basic=False,

View File

@@ -775,7 +775,7 @@ def sitebackup(self, data):
.format(data['site_name']), backup_path)
if data['currsitetype'] in ['html', 'php', 'php72', 'php74',
'php73', 'php80', 'php81', 'php82', 'php83'
'php73', 'php80', 'php81', 'php82', 'php83', 'php84'
'proxy', 'mysql']:
if not data['wp']:
Log.info(self, "Backing up Webroot \t\t", end='')
@@ -836,7 +836,7 @@ def site_package_check(self, stype):
stack.app = self.app
pargs = self.app.pargs
if stype in ['html', 'proxy', 'php', 'mysql', 'wp', 'wpsubdir',
'wpsubdomain', 'php74', 'php80', 'php81', 'php82', 'php83', 'alias', 'subsite']:
'wpsubdomain', 'php74', 'php80', 'php81', 'php82', 'php83', 'php84', 'alias', 'subsite']:
Log.debug(self, "Setting apt_packages variable for Nginx")
# Check if server has nginx-custom package
@@ -872,7 +872,7 @@ def site_package_check(self, stype):
wo_nginx.write('fastcgi_param \tSCRIPT_FILENAME '
'\t$request_filename;\n')
php_versions = ['php74', 'php80', 'php81', 'php82', 'php83']
php_versions = ['php74', 'php80', 'php81', 'php82', 'php83', 'php84']
selected_versions = [version for version in php_versions if getattr(pargs, version)]
if len(selected_versions) > 1:
@@ -881,7 +881,7 @@ def site_package_check(self, stype):
if ((not pargs.php74) and (not pargs.php80) and
(not pargs.php81) and (not pargs.php82) and
(not pargs.php83) and
(not pargs.php83) and (not pargs.php84) and
stype in ['php', 'mysql', 'wp', 'wpsubdir',
'wpsubdomain']):
Log.debug(self, "Setting apt_packages variable for PHP")
@@ -1080,7 +1080,7 @@ def detSitePar(opts):
for key, val in opts.items():
if val and key in ['html', 'php', 'mysql', 'wp',
'wpsubdir', 'wpsubdomain',
'php74', 'php80', 'php81', 'php82', 'php83']:
'php74', 'php80', 'php81', 'php82', 'php83', 'php84']:
typelist.append(key)
elif val and key in ['wpfc', 'wpsc', 'wpredis', 'wprocket', 'wpce']:
cachelist.append(key)
@@ -1126,6 +1126,12 @@ def detSitePar(opts):
cachetype = 'basic'
else:
cachetype = cachelist[0]
elif False not in [x in ('php84', 'mysql', 'html') for x in typelist]:
sitetype = 'mysql'
if not cachelist:
cachetype = 'basic'
else:
cachetype = cachelist[0]
elif False not in [x in ('php', 'mysql') for x in typelist]:
sitetype = 'mysql'
if not cachelist:
@@ -1162,6 +1168,12 @@ def detSitePar(opts):
cachetype = 'basic'
else:
cachetype = cachelist[0]
elif False not in [x in ('php84', 'mysql') for x in typelist]:
sitetype = 'mysql'
if not cachelist:
cachetype = 'basic'
else:
cachetype = cachelist[0]
elif False not in [x in ('html', 'mysql') for x in typelist]:
sitetype = 'mysql'
if not cachelist:
@@ -1216,6 +1228,12 @@ def detSitePar(opts):
cachetype = 'basic'
else:
cachetype = cachelist[0]
elif False not in [x in ('wp', 'php84') for x in typelist]:
sitetype = 'wp'
if not cachelist:
cachetype = 'basic'
else:
cachetype = cachelist[0]
elif False not in [x in ('wpsubdir', 'php74') for x in typelist]:
sitetype = 'wpsubdir'
if not cachelist:
@@ -1246,6 +1264,12 @@ def detSitePar(opts):
cachetype = 'basic'
else:
cachetype = cachelist[0]
elif False not in [x in ('wpsubdir', 'php84') for x in typelist]:
sitetype = 'wpsubdir'
if not cachelist:
cachetype = 'basic'
else:
cachetype = cachelist[0]
elif False not in [x in ('wpsubdomain', 'php74') for x in typelist]:
sitetype = 'wpsubdomain'
if not cachelist:
@@ -1276,6 +1300,12 @@ def detSitePar(opts):
cachetype = 'basic'
else:
cachetype = cachelist[0]
elif False not in [x in ('wpsubdomain', 'php84') for x in typelist]:
sitetype = 'wpsubdomain'
if not cachelist:
cachetype = 'basic'
else:
cachetype = cachelist[0]
else:
raise RuntimeError("could not determine site and cache type")
else:
@@ -1297,6 +1327,9 @@ def detSitePar(opts):
elif (not typelist or "php83" in typelist) and cachelist:
sitetype = 'wp'
cachetype = cachelist[0]
elif (not typelist or "php84" in typelist) and cachelist:
sitetype = 'wp'
cachetype = cachelist[0]
elif typelist and (not cachelist):
sitetype = typelist[0]
cachetype = 'basic'

View File

@@ -198,7 +198,7 @@ class WOSiteUpdateController(CementBaseController):
pargs.ngxblocker or pargs.letsencrypt == 'renew') and not (
pargs.html or pargs.php or pargs.php74 or pargs.php80 or
pargs.php81 or pargs.php82 or
pargs.php83 or pargs.mysql or pargs.wp or pargs.wpfc or pargs.wpsc or
pargs.php83 or pargs.php84 or pargs.mysql or pargs.wp or pargs.wpfc or pargs.wpsc or
pargs.wprocket or pargs.wpce or
pargs.wpsubdir or pargs.wpsubdomain)):
@@ -268,19 +268,19 @@ class WOSiteUpdateController(CementBaseController):
if (((stype == 'php' and
oldsitetype not in ['html', 'proxy', 'php', 'php74', 'php80',
'php81', 'php82', 'php83']) or
'php81', 'php82', 'php83', 'php84']) or
(stype == 'mysql' and oldsitetype not in [
'html', 'php', 'php74', 'php80', 'php81',
'php82', 'php83', 'proxy']) or
'php82', 'php83', 'php84', 'proxy']) or
(stype == 'wp' and oldsitetype not in [
'html', 'php', 'php74', 'php80', 'php81',
'php82', 'php83', 'mysql', 'proxy', 'wp']) or
'php82', 'php83', 'php84', 'mysql', 'proxy', 'wp']) or
(stype == 'wpsubdir' and oldsitetype in ['wpsubdomain']) or
(stype == 'wpsubdomain' and oldsitetype in ['wpsubdir']) or
(stype == oldsitetype and cache == oldcachetype)) and
not (pargs.php74 or pargs.php80 or
pargs.php81 or pargs.php82 or
pargs.php83 or pargs.alias)):
pargs.php83 or pargs.php84 or pargs.alias)):
Log.info(self, Log.FAIL + "can not update {0} {1} to {2} {3}".
format(oldsitetype, oldcachetype, stype, cache))
return 1
@@ -338,7 +338,7 @@ class WOSiteUpdateController(CementBaseController):
site_name=wo_domain, www_domain=wo_www_domain,
static=False, basic=True, wp=False, wpfc=False,
php74=False, php80=False, php81=False, php82=False, php83=False,
wpsc=False, wpredis=False, wprocket=False, wpce=False,
php84=False, wpsc=False, wpredis=False, wprocket=False, wpce=False,
multisite=False, wpsubdir=False, webroot=wo_site_webroot,
currsitetype=oldsitetype, currcachetype=oldcachetype)
@@ -362,11 +362,11 @@ class WOSiteUpdateController(CementBaseController):
data['wpsubdir'] = True
if ((pargs.php74 or pargs.php80 or pargs.php81 or
pargs.php82 or pargs.php83) and
pargs.php82 or pargs.php83 or pargs.php84) and
(not data)):
Log.debug(
self, "pargs php74, "
"or php80, or php81 or php82 or php83 enabled")
"or php80, or php81 or php82 or php83 or php84 enabled")
data = dict(
site_name=wo_domain,
www_domain=wo_www_domain,
@@ -383,7 +383,8 @@ class WOSiteUpdateController(CementBaseController):
elif (oldsitetype == 'php' or oldsitetype == 'mysql' or
oldsitetype == 'php73' or oldsitetype == 'php74' or
oldsitetype == 'php80' or oldsitetype == 'php81' or
oldsitetype == 'php82' or oldsitetype == 'php83'):
oldsitetype == 'php82' or oldsitetype == 'php83' or
oldsitetype == 'php84'):
data['static'] = False
data['wp'] = False
data['multisite'] = False
@@ -435,7 +436,7 @@ class WOSiteUpdateController(CementBaseController):
if (data and (not pargs.php74) and
(not pargs.php80) and (not pargs.php81) and (not pargs.php82)
and (not pargs.php83)):
and (not pargs.php83) and (not pargs.php84)):
data[pargs_version] = bool(old_version_var is True)
Log.debug(
self, f"data {pargs_version} = {data[pargs_version]}")
@@ -795,7 +796,7 @@ class WOSiteUpdateController(CementBaseController):
# Setup WordPress if old sites are html/php/mysql sites
if data['wp'] and oldsitetype in ['html', 'proxy', 'php', 'php72',
'mysql', 'php73', 'php74', 'php80',
'php81', 'php82', 'php83']:
'php81', 'php82', 'php83', 'php84']:
try:
wo_wp_creds = setupwordpress(self, data)
except SiteError as e:

View File

@@ -135,6 +135,7 @@ class WOStackController(CementBaseController):
pargs.php81 = True
pargs.php82 = True
pargs.php83 = True
pargs.php84 = True
pargs.redis = True
pargs.proftpd = True
@@ -192,6 +193,7 @@ class WOStackController(CementBaseController):
'php81': WOVar.wo_php81,
'php82': WOVar.wo_php82,
'php83': WOVar.wo_php83,
'php84': WOVar.wo_php84,
}
for parg_version, version in WOVar.wo_php_versions.items():
@@ -477,7 +479,8 @@ class WOStackController(CementBaseController):
WOAptGet.is_installed(self, 'php8.0-fpm') or
WOAptGet.is_installed(self, 'php8.1-fpm') or
WOAptGet.is_installed(self, 'php8.2-fpm') or
WOAptGet.is_installed(self, 'php8.3-fpm')):
WOAptGet.is_installed(self, 'php8.3-fpm') or
WOAptGet.is_installed(self, 'php8.4-fpm')):
pargs.php = True
Log.debug(self, "Setting packages variable for utils")
packages = packages + [[
@@ -577,6 +580,7 @@ class WOStackController(CementBaseController):
pargs.php81 = True
pargs.php82 = True
pargs.php83 = True
pargs.php84 = True
pargs.fail2ban = True
pargs.proftpd = True
pargs.utils = True
@@ -618,6 +622,7 @@ class WOStackController(CementBaseController):
'php81': WOVar.wo_php81,
'php82': WOVar.wo_php82,
'php83': WOVar.wo_php83,
'php84': WOVar.wo_php84,
}
# Loop through all versions.
@@ -898,6 +903,7 @@ class WOStackController(CementBaseController):
pargs.php81 = True
pargs.php82 = True
pargs.php83 = True
pargs.php84 = True
pargs.fail2ban = True
pargs.proftpd = True
pargs.utils = True
@@ -939,6 +945,7 @@ class WOStackController(CementBaseController):
'php81': WOVar.wo_php81,
'php82': WOVar.wo_php82,
'php83': WOVar.wo_php83,
'php84': WOVar.wo_php84,
}
for parg_version, version in WOVar.wo_php_versions.items():

View File

@@ -85,7 +85,8 @@ def pre_pref(self, apt_packages):
('php8.0-fpm' in apt_packages) or
('php8.1-fpm' in apt_packages) or
('php8.2-fpm' in apt_packages) or
('php8.3-fpm' in apt_packages)):
('php8.3-fpm' in apt_packages) or
('php8.4-fpm' in apt_packages)):
if (WOVar.wo_distro == 'ubuntu'):
Log.debug(self, 'Adding ppa for PHP')
Log.info(self, "Adding repository for PHP, please wait...")

View File

@@ -107,6 +107,7 @@ class WOStackUpgradeController(CementBaseController):
pargs.php81 = True
pargs.php82 = True
pargs.php83 = True
pargs.php84 = True
pargs.mysql = True
pargs.wpcli = True
@@ -140,6 +141,7 @@ class WOStackUpgradeController(CementBaseController):
'php81': WOVar.wo_php81,
'php82': WOVar.wo_php82,
'php83': WOVar.wo_php83,
'php84': WOVar.wo_php84,
}
for parg_version, version in WOVar.wo_php_versions.items():
@@ -279,6 +281,7 @@ class WOStackUpgradeController(CementBaseController):
"php8.1-fpm" in apt_packages or
"php8.2-fpm" in apt_packages or
"php8.3-fpm" in apt_packages or
"php8.4-fpm" in apt_packages or
"redis-server" in apt_packages or
"nginx-custom" in apt_packages or
"mariadb-server" in apt_packages):

View File

@@ -165,6 +165,26 @@ upstream debug83 {
server 127.0.0.1:9178;
}
#-------------------------------
# PHP 8.4
#-------------------------------
# PHP 8.4 upstream with load-balancing on two unix sockets
upstream php84 {
least_conn;
server unix:/var/run/php/php84-fpm.sock;
server unix:/var/run/php/php84-two-fpm.sock;
keepalive 5;
}
# PHP 8.4 debug
upstream debug83 {
# Debug Pool
server 127.0.0.1:9179;
}
#-------------------------------
# Netdata
#-------------------------------
@@ -198,4 +218,5 @@ upstream multiphp {
server unix:/var/run/php/php81-fpm.sock;
server unix:/var/run/php/php82-fpm.sock;
server unix:/var/run/php/php83-fpm.sock;
server unix:/var/run/php/php84-fpm.sock;
}