reworked php7.3 stack

* replace previous stack php7 variables
* properly set stack php = php7.2 and php73 = php7.3
* rename upstream php72 and php73 to avoid issues when migrating from EEv3
* use unix socket in nginx upstream instead of TCP/IP
This commit is contained in:
VirtuBox
2019-03-04 06:44:21 +01:00
parent 1b4b90040c
commit a49b9701bd
15 changed files with 167 additions and 200 deletions

View File

@@ -42,7 +42,7 @@ class WODebugController(CementBaseController):
action='store' or 'store_const', action='store' or 'store_const',
choices=('on', 'off'), const='on', nargs='?')), choices=('on', 'off'), const='on', nargs='?')),
(['--php'], (['--php'],
dict(help='start/stop debugging server PHP configuration', dict(help='start/stop debugging server PHP 7.2 configuration',
action='store' or 'store_const', action='store' or 'store_const',
choices=('on', 'off'), const='on', nargs='?')), choices=('on', 'off'), const='on', nargs='?')),
(['--fpm'], (['--fpm'],
@@ -50,11 +50,11 @@ class WODebugController(CementBaseController):
action='store' or 'store_const', action='store' or 'store_const',
choices=('on', 'off'), const='on', nargs='?')), choices=('on', 'off'), const='on', nargs='?')),
(['--php73'], (['--php73'],
dict(help='start/stop debugging server PHP 7.2 configuration', dict(help='start/stop debugging server PHP 7.3 configuration',
action='store' or 'store_const', action='store' or 'store_const',
choices=('on', 'off'), const='on', nargs='?')), choices=('on', 'off'), const='on', nargs='?')),
(['--fpm7'], (['--fpm73'],
dict(help='start/stop debugging fastcgi 7.2 configuration', dict(help='start/stop debugging fastcgi 7.3 configuration',
action='store' or 'store_const', action='store' or 'store_const',
choices=('on', 'off'), const='on', nargs='?')), choices=('on', 'off'), const='on', nargs='?')),
(['--mysql'], (['--mysql'],
@@ -301,37 +301,37 @@ class WODebugController(CementBaseController):
if (self.app.pargs.php73 == 'on' and not self.app.pargs.site_name): if (self.app.pargs.php73 == 'on' and not self.app.pargs.site_name):
if (WOVariables.wo_platform_codename == 'wheezy' or WOVariables.wo_platform_codename == 'precise'): if (WOVariables.wo_platform_codename == 'wheezy' or WOVariables.wo_platform_codename == 'precise'):
Log.error(self, "PHP 7.2 not supported.") Log.error(self, "PHP 7.3 not supported.")
if not (WOShellExec.cmd_exec(self, "sed -n \"/upstream php7" if not (WOShellExec.cmd_exec(self, "sed -n \"/upstream php73"
"{/,/}/p \" /etc/nginx/" "{/,/}/p \" /etc/nginx/"
"conf.d/upstream.conf " "conf.d/upstream.conf "
"| grep 9172")): "| grep 9173")):
Log.info(self, "Enabling PHP 7.2 debug") Log.info(self, "Enabling PHP 7.3 debug")
# Change upstream.conf # Change upstream.conf
nc = NginxConfig() nc = NginxConfig()
nc.loadf('/etc/nginx/conf.d/upstream.conf') nc.loadf('/etc/nginx/conf.d/upstream.conf')
nc.set([('upstream', 'php73',), 'server'], '127.0.0.1:9172') nc.set([('upstream', 'php73',), 'server'], '127.0.0.1:9173')
if os.path.isfile("/etc/nginx/common/wpfc-hhvm.conf"): if os.path.isfile("/etc/nginx/common/wpfc-hhvm.conf"):
nc.set([('upstream', 'hhvm',), 'server'], '127.0.0.1:9172') nc.set([('upstream', 'hhvm',), 'server'], '127.0.0.1:9173')
nc.savef('/etc/nginx/conf.d/upstream.conf') nc.savef('/etc/nginx/conf.d/upstream.conf')
# Enable xdebug # Enable xdebug
WOFileUtils.searchreplace(self, "/etc/php/7.2/mods-available/" WOFileUtils.searchreplace(self, "/etc/php/7.3/mods-available/"
"xdebug.ini", "xdebug.ini",
";zend_extension", ";zend_extension",
"zend_extension") "zend_extension")
# Fix slow log is not enabled default in PHP5.6 # Fix slow log is not enabled default in PHP5.6
config = configparser.ConfigParser() config = configparser.ConfigParser()
config.read('/etc/php/7.2/fpm/pool.d/debug.conf') config.read('/etc/php/7.3/fpm/pool.d/debug.conf')
config['debug']['slowlog'] = '/var/log/php/7.2/slow.log' config['debug']['slowlog'] = '/var/log/php/7.3/slow.log'
config['debug']['request_slowlog_timeout'] = '10s' config['debug']['request_slowlog_timeout'] = '10s'
with open('/etc/php/7.2/fpm/pool.d/debug.conf', with open('/etc/php/7.3/fpm/pool.d/debug.conf',
encoding='utf-8', mode='w') as confifile: encoding='utf-8', mode='w') as confifile:
Log.debug(self, "Writting debug.conf configuration into " Log.debug(self, "Writting debug.conf configuration into "
"/etc/php/7.2/fpm/pool.d/debug.conf") "/etc/php/7.3/fpm/pool.d/debug.conf")
config.write(confifile) config.write(confifile)
self.trigger_php = True self.trigger_php = True
@@ -339,11 +339,11 @@ class WODebugController(CementBaseController):
else: else:
Log.info(self, "PHP debug is already enabled") Log.info(self, "PHP debug is already enabled")
self.msg = self.msg + ['/var/log/php/7.2/slow.log'] self.msg = self.msg + ['/var/log/php/7.3/slow.log']
# PHP global debug stop # PHP global debug stop
elif (self.app.pargs.php73 == 'off' and not self.app.pargs.site_name): elif (self.app.pargs.php73 == 'off' and not self.app.pargs.site_name):
if WOShellExec.cmd_exec(self, " sed -n \"/upstream php73 {/,/}/p\" " if WOShellExec.cmd_exec(self, " sed -n \"/upstream php72 {/,/}/p\" "
"/etc/nginx/conf.d/upstream.conf " "/etc/nginx/conf.d/upstream.conf "
"| grep 9172"): "| grep 9172"):
Log.info(self, "Disabling PHP 7.2 debug") Log.info(self, "Disabling PHP 7.2 debug")
@@ -351,7 +351,7 @@ class WODebugController(CementBaseController):
# Change upstream.conf # Change upstream.conf
nc = NginxConfig() nc = NginxConfig()
nc.loadf('/etc/nginx/conf.d/upstream.conf') nc.loadf('/etc/nginx/conf.d/upstream.conf')
nc.set([('upstream', 'php73',), 'server'], '127.0.0.1:9072') nc.set([('upstream', 'php72',), 'server'], 'unix:/var/run/php/php72-fpm.sock')
if os.path.isfile("/etc/nginx/common/wpfc-hhvm.conf"): if os.path.isfile("/etc/nginx/common/wpfc-hhvm.conf"):
nc.set([('upstream', 'hhvm',), 'server'], '127.0.0.1:8000') nc.set([('upstream', 'hhvm',), 'server'], '127.0.0.1:8000')
nc.savef('/etc/nginx/conf.d/upstream.conf') nc.savef('/etc/nginx/conf.d/upstream.conf')
@@ -368,47 +368,47 @@ class WODebugController(CementBaseController):
Log.info(self, "PHP 7.2 debug is already disabled") Log.info(self, "PHP 7.2 debug is already disabled")
@expose(hide=True) @expose(hide=True)
def debug_fpm7(self): def debug_fpm73(self):
"""Start/Stop PHP5-FPM debug""" """Start/Stop PHP5-FPM debug"""
# PHP5-FPM start global debug # PHP5-FPM start global debug
if (self.app.pargs.fpm7 == 'on' and not self.app.pargs.site_name): if (self.app.pargs.fpm73 == 'on' and not self.app.pargs.site_name):
if not WOShellExec.cmd_exec(self, "grep \"log_level = debug\" " if not WOShellExec.cmd_exec(self, "grep \"log_level = debug\" "
"/etc/php/7.2/fpm/php-fpm.conf"): "/etc/php/7.3/fpm/php-fpm.conf"):
Log.info(self, "Setting up PHP7.2-FPM log_level = debug") Log.info(self, "Setting up PHP7.3-FPM log_level = debug")
config = configparser.ConfigParser() config = configparser.ConfigParser()
config.read('/etc/php/7.2/fpm/php-fpm.conf') config.read('/etc/php/7.3/fpm/php-fpm.conf')
config.remove_option('global', 'include') config.remove_option('global', 'include')
config['global']['log_level'] = 'debug' config['global']['log_level'] = 'debug'
config['global']['include'] = '/etc/php/7.2/fpm/pool.d/*.conf' config['global']['include'] = '/etc/php/7.3/fpm/pool.d/*.conf'
with open('/etc/php/7.2/fpm/php-fpm.conf', with open('/etc/php/7.3/fpm/php-fpm.conf',
encoding='utf-8', mode='w') as configfile: encoding='utf-8', mode='w') as configfile:
Log.debug(self, "Writing the PHP configuration into " Log.debug(self, "Writing the PHP configuration into "
"/etc/php/7.2/fpm/php-fpm.conf") "/etc/php/7.3/fpm/php-fpm.conf")
config.write(configfile) config.write(configfile)
self.trigger_php = True self.trigger_php = True
else: else:
Log.info(self, "PHP7.2-FPM log_level = debug already setup") Log.info(self, "PHP7.3-FPM log_level = debug already setup")
self.msg = self.msg + ['/var/log/php/7.2/fpm.log'] self.msg = self.msg + ['/var/log/php/7.3/fpm.log']
# PHP5-FPM stop global debug # PHP5-FPM stop global debug
elif (self.app.pargs.fpm7 == 'off' and not self.app.pargs.site_name): elif (self.app.pargs.fpm73 == 'off' and not self.app.pargs.site_name):
if WOShellExec.cmd_exec(self, "grep \"log_level = debug\" " if WOShellExec.cmd_exec(self, "grep \"log_level = debug\" "
"/etc/php/7.2/fpm/php-fpm.conf"): "/etc/php/7.3/fpm/php-fpm.conf"):
Log.info(self, "Disabling PHP7.2-FPM log_level = debug") Log.info(self, "Disabling PHP7.3-FPM log_level = debug")
config = configparser.ConfigParser() config = configparser.ConfigParser()
config.read('/etc/php/7.2/fpm/php-fpm.conf') config.read('/etc/php/7.3/fpm/php-fpm.conf')
config.remove_option('global', 'include') config.remove_option('global', 'include')
config['global']['log_level'] = 'notice' config['global']['log_level'] = 'notice'
config['global']['include'] = '/etc/php/7.2/fpm/pool.d/*.conf' config['global']['include'] = '/etc/php/7.3/fpm/pool.d/*.conf'
with open('/etc/php/7.2/fpm/php-fpm.conf', with open('/etc/php/7.3/fpm/php-fpm.conf',
encoding='utf-8', mode='w') as configfile: encoding='utf-8', mode='w') as configfile:
Log.debug(self, "Writing the php7.2 configuration into " Log.debug(self, "Writing the php7.3 configuration into "
"/etc/php/7.2/fpm/php-fpm.conf") "/etc/php/7.3/fpm/php-fpm.conf")
config.write(configfile) config.write(configfile)
self.trigger_php = True self.trigger_php = True
else: else:
Log.info(self, "PHP7.2-FPM log_level = debug already disabled") Log.info(self, "PHP7.3-FPM log_level = debug already disabled")
@expose(hide=True) @expose(hide=True)
def debug_mysql(self): def debug_mysql(self):
@@ -609,9 +609,9 @@ class WODebugController(CementBaseController):
if self.app.pargs.fpm: if self.app.pargs.fpm:
self.app.pargs.fpm = 'off' self.app.pargs.fpm = 'off'
self.debug_fpm() self.debug_fpm()
if self.app.pargs.fpm7: if self.app.pargs.fpm73:
self.app.pargs.fpm7 = 'off' self.app.pargs.fpm73 = 'off'
self.debug_fpm7() self.debug_fpm73()
if self.app.pargs.mysql: if self.app.pargs.mysql:
# MySQL debug will not work for remote MySQL # MySQL debug will not work for remote MySQL
if WOVariables.wo_mysql_host is "localhost": if WOVariables.wo_mysql_host is "localhost":
@@ -636,8 +636,8 @@ class WODebugController(CementBaseController):
if WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic': if WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic':
if WOAptGet.is_installed(self, 'php7.2-fpm'): if WOAptGet.is_installed(self, 'php7.2-fpm'):
WOService.reload_service(self, 'php7.2-fpm') WOService.reload_service(self, 'php7.2-fpm')
if WOAptGet.is_installed(self, 'php7.2-fpm'): if WOAptGet.is_installed(self, 'php7.3-fpm'):
WOService.reload_service(self, 'php7.2-fpm') WOService.reload_service(self, 'php7.3-fpm')
else: else:
WOService.reload_service(self, 'php7.2-fpm') WOService.reload_service(self, 'php7.2-fpm')
self.app.close(0) self.app.close(0)
@@ -651,8 +651,8 @@ class WODebugController(CementBaseController):
self.trigger_nginx = False self.trigger_nginx = False
self.trigger_php = False self.trigger_php = False
if ((not self.app.pargs.nginx) and (not self.app.pargs.php) and (not self.app.pargs.php7) if ((not self.app.pargs.nginx) and (not self.app.pargs.php) and (not self.app.pargs.php73)
and (not self.app.pargs.fpm) and (not self.app.pargs.fpm7) and (not self.app.pargs.mysql) and (not self.app.pargs.fpm) and (not self.app.pargs.fpm73) and (not self.app.pargs.mysql)
and (not self.app.pargs.wp) and (not self.app.pargs.rewrite) and (not self.app.pargs.wp) and (not self.app.pargs.rewrite)
and (not self.app.pargs.all) and (not self.app.pargs.all)
and (not self.app.pargs.site_name) and (not self.app.pargs.site_name)
@@ -726,7 +726,7 @@ class WODebugController(CementBaseController):
self.app.pargs.fpm = 'on' self.app.pargs.fpm = 'on'
if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') and WOAptGet.is_installed(self, 'php7.2-fpm'): if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') and WOAptGet.is_installed(self, 'php7.2-fpm'):
self.app.pargs.php73 = 'on' self.app.pargs.php73 = 'on'
self.app.pargs.fpm7 = 'on' self.app.pargs.fpm73 = 'on'
self.app.pargs.mysql = 'on' self.app.pargs.mysql = 'on'
self.app.pargs.rewrite = 'on' self.app.pargs.rewrite = 'on'
@@ -738,12 +738,12 @@ class WODebugController(CementBaseController):
self.app.pargs.fpm = 'off' self.app.pargs.fpm = 'off'
if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') and WOAptGet.is_installed(self, 'php7.2-fpm'): if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') and WOAptGet.is_installed(self, 'php7.2-fpm'):
self.app.pargs.php73 = 'off' self.app.pargs.php73 = 'off'
self.app.pargs.fpm7 = 'off' self.app.pargs.fpm73 = 'off'
self.app.pargs.mysql = 'off' self.app.pargs.mysql = 'off'
self.app.pargs.rewrite = 'off' self.app.pargs.rewrite = 'off'
if ((not self.app.pargs.nginx) and (not self.app.pargs.php) and (not self.app.pargs.php73) if ((not self.app.pargs.nginx) and (not self.app.pargs.php) and (not self.app.pargs.php73)
and (not self.app.pargs.fpm) and (not self.app.pargs.fpm7) and (not self.app.pargs.mysql) and (not self.app.pargs.fpm) and (not self.app.pargs.fpm73) and (not self.app.pargs.mysql)
and (not self.app.pargs.wp) and (not self.app.pargs.rewrite) and (not self.app.pargs.wp) and (not self.app.pargs.rewrite)
and self.app.pargs.site_name): and self.app.pargs.site_name):
self.app.args.print_help() self.app.args.print_help()
@@ -782,12 +782,12 @@ class WODebugController(CementBaseController):
# Reload PHP # Reload PHP
if self.trigger_php: if self.trigger_php:
if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'):
if WOAptGet.is_installed(self, 'php5.6-fpm'):
WOService.restart_service(self, 'php5.6-fpm')
if WOAptGet.is_installed(self, 'php7.2-fpm'): if WOAptGet.is_installed(self, 'php7.2-fpm'):
WOService.restart_service(self, 'php7.2-fpm') WOService.restart_service(self, 'php7.2-fpm')
if WOAptGet.is_installed(self, 'php7.3-fpm'):
WOService.restart_service(self, 'php7.3-fpm')
else: else:
WOService.restart_service(self, 'php5-fpm') WOService.restart_service(self, 'php7.2-fpm')
if WOVariables.wo_platform_codename == 'jessie': if WOVariables.wo_platform_codename == 'jessie':
WOService.restart_service(self, 'php7.2-fpm') WOService.restart_service(self, 'php7.2-fpm')

View File

@@ -250,7 +250,7 @@ class WOInfoController(CementBaseController):
self.app.pargs.nginx = True self.app.pargs.nginx = True
self.app.pargs.php = True self.app.pargs.php = True
self.app.pargs.mysql = True self.app.pargs.mysql = True
if WOAptGet.is_installed(self, 'php7.2-fpm'): if WOAptGet.is_installed(self, 'php7.3-fpm'):
self.app.pargs.php = True self.app.pargs.php = True
if self.app.pargs.nginx: if self.app.pargs.nginx:

View File

@@ -308,9 +308,9 @@ class WOSiteCreateController(CementBaseController):
(['--html'], (['--html'],
dict(help="create html site", action='store_true')), dict(help="create html site", action='store_true')),
(['--php'], (['--php'],
dict(help="create php site", action='store_true')),
(['--php73'],
dict(help="create php 7.2 site", action='store_true')), dict(help="create php 7.2 site", action='store_true')),
(['--php73'],
dict(help="create php 7.3 site", action='store_true')),
(['--mysql'], (['--mysql'],
dict(help="create mysql site", action='store_true')), dict(help="create mysql site", action='store_true')),
(['--wp'], (['--wp'],
@@ -461,10 +461,10 @@ class WOSiteCreateController(CementBaseController):
check_prompt = input("Type \"y\" to continue [n]:") check_prompt = input("Type \"y\" to continue [n]:")
if check_prompt != "Y" and check_prompt != "y": if check_prompt != "Y" and check_prompt != "y":
Log.info(self, "Not using PHP 7.2 for site.") Log.info(self, "Not using PHP 7.2 for site.")
data['php73'] = False data['php73'] = True
data['basic'] = True data['basic'] = True
php73 = 0 php73 = 1
self.app.pargs.php73 = False self.app.pargs.php73 = True
else: else:
data['php73'] = True data['php73'] = True
php73 = 1 php73 = 1
@@ -564,7 +564,7 @@ class WOSiteCreateController(CementBaseController):
return return
if data['php73']: if data['php73']:
php_version = "7.2" php_version = "7.3"
else: else:
php_version = "7.2" php_version = "7.2"
@@ -1225,7 +1225,7 @@ class WOSiteUpdateController(CementBaseController):
if pargs.wpredis and data['currcachetype'] != 'wpredis': if pargs.wpredis and data['currcachetype'] != 'wpredis':
if (pargs.experimental): if (not pargs.experimental):
Log.info(self, "Redis is experimental feature and it may not" Log.info(self, "Redis is experimental feature and it may not"
" work with all plugins of your site.\nYou can " " work with all plugins of your site.\nYou can "
"disable it by changing cache type later.\nDo you wish" "disable it by changing cache type later.\nDo you wish"

View File

@@ -711,18 +711,18 @@ def site_package_check(self, stype):
if self.app.pargs.php and self.app.pargs.php73: if self.app.pargs.php and self.app.pargs.php73:
Log.error(self,"Error: two different PHP versions cannot be combined within the same WordOps site") Log.error(self,"Error: two different PHP versions cannot be combined within the same WordOps site")
if not self.app.pargs.php and stype in ['php', 'mysql', 'wp', 'wpsubdir', 'wpsubdomain']: if not self.app.pargs.php73 and stype in ['php', 'mysql', 'wp', 'wpsubdir', 'wpsubdomain']:
Log.debug(self, "Setting apt_packages variable for PHP 7.2") Log.debug(self, "Setting apt_packages variable for PHP 7.2")
apt_packages = apt_packages + WOVariables.wo_php + WOVariables.wo_php_extra apt_packages = apt_packages + WOVariables.wo_php + WOVariables.wo_php_extra
if self.app.pargs.php and stype in [ 'mysql', 'wp', 'wpsubdir', 'wpsubdomain']: if self.app.pargs.php73 and stype in [ 'mysql', 'wp', 'wpsubdir', 'wpsubdomain']:
if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'):
Log.debug(self, "Setting apt_packages variable for PHP 7.2") Log.debug(self, "Setting apt_packages variable for PHP 7.3")
if not WOAptGet.is_installed(self, 'php7.3-fpm'): if not WOAptGet.is_installed(self, 'php7.3-fpm'):
apt_packages = apt_packages + WOVariables.wo_php + WOVariables.wo_php_extra apt_packages = apt_packages + WOVariables.wo_php73 + WOVariables.wo_php_extra
else: else:
Log.debug(self, "Setting apt_packages variable for PHP 7.2") Log.debug(self, "Setting apt_packages variable for PHP 7.3")
if not WOAptGet.is_installed(self, 'php7.2-fpm'): if not WOAptGet.is_installed(self, 'php7.3-fpm'):
apt_packages = apt_packages + WOVariables.wo_php73 apt_packages = apt_packages + WOVariables.wo_php73
if stype in ['mysql', 'wp', 'wpsubdir', 'wpsubdomain']: if stype in ['mysql', 'wp', 'wpsubdir', 'wpsubdomain']:
@@ -896,8 +896,8 @@ def site_package_check(self, stype):
if not WOFileUtils.grep(self, "/etc/nginx/conf.d/upstream.conf", if not WOFileUtils.grep(self, "/etc/nginx/conf.d/upstream.conf",
"php73"): "php73"):
with open("/etc/nginx/conf.d/upstream.conf", "a") as php_file: with open("/etc/nginx/conf.d/upstream.conf", "a") as php_file:
php_file.write("upstream php73 {\nserver 127.0.0.1:9072;\n}\n" php_file.write("upstream php73 {\nserver unix:/var/run/php/php73-fpm.sock;\n}\n"
"upstream debug72 {\nserver 127.0.0.1:9172;\n}\n") "upstream debug73 {\nserver 127.0.0.1:9173;\n}\n")
return(stack.install(apt_packages=apt_packages, packages=packages, return(stack.install(apt_packages=apt_packages, packages=packages,
disp_msg=False)) disp_msg=False))

View File

@@ -76,7 +76,7 @@ class WOStackController(CementBaseController):
(['--phpredisadmin'], (['--phpredisadmin'],
dict(help='Install phpRedisAdmin', action='store_true')), dict(help='Install phpRedisAdmin', action='store_true')),
] ]
usage = "ee stack (command) [options]" usage = "wo stack (command) [options]"
@expose(hide=True) @expose(hide=True)
def default(self): def default(self):
@@ -154,13 +154,14 @@ class WOStackController(CementBaseController):
WORepo.add_key(self, WOVariables.wo_nginx_key) WORepo.add_key(self, WOVariables.wo_nginx_key)
if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'):
if set(WOVariables.wo_php73).issubset(set(apt_packages)): if set(WOVariables.wo_php73).issubset(set(apt_packages)) \
Log.info(self, "Adding repository for PHP 7.3, please wait...") or set(WOVariables.wo_php).issubset(set(apt_packages)):
Log.info(self, "Adding repository for PHP, please wait...")
Log.debug(self, 'Adding ppa for PHP') Log.debug(self, 'Adding ppa for PHP')
WORepo.add(self, ppa=WOVariables.wo_php_repo) WORepo.add(self, ppa=WOVariables.wo_php_repo)
else: else:
if set(WOVariables.wo_php).issubset(set(apt_packages)): if set(WOVariables.wo_php).issubset(set(apt_packages)):
Log.info(self, "Adding repository for PHP 7.2, please wait...") Log.info(self, "Adding repository for PHP, please wait...")
# Add repository for php # Add repository for php
if WOVariables.wo_platform_distro == 'debian': if WOVariables.wo_platform_distro == 'debian':
if WOVariables.wo_platform_codename != 'jessie': if WOVariables.wo_platform_codename != 'jessie':
@@ -244,7 +245,7 @@ class WOStackController(CementBaseController):
wo_nginx.close() wo_nginx.close()
data = dict(php="9000", debug="9001", hhvm="8000", php73="9072", debug7="9172", data = dict(php="9000", debug="9001", hhvm="8000", php73="9072", debug7="9172",
hhvmconf=False, php7conf=True if WOAptGet.is_installed(self, 'php7.2-fpm') else False) hhvmconf=False, php7conf=True if WOAptGet.is_installed(self, 'php7.3-fpm') else False)
Log.debug(self, 'Writting the nginx configuration to ' Log.debug(self, 'Writting the nginx configuration to '
'file /etc/nginx/conf.d/upstream.conf') 'file /etc/nginx/conf.d/upstream.conf')
wo_nginx = open('/etc/nginx/conf.d/upstream.conf', wo_nginx = open('/etc/nginx/conf.d/upstream.conf',
@@ -627,8 +628,8 @@ class WOStackController(CementBaseController):
if not WOFileUtils.grep(self, "/etc/nginx/conf.d/upstream.conf", if not WOFileUtils.grep(self, "/etc/nginx/conf.d/upstream.conf",
"php73"): "php73"):
with open("/etc/nginx/conf.d/upstream.conf", "a") as php_file: with open("/etc/nginx/conf.d/upstream.conf", "a") as php_file:
php_file.write("upstream php73 {\nserver 127.0.0.1:9072;\n}\n" php_file.write("upstream php73 {\nserver unix:/var/run/php/php73-fpm.sock;\n}\n"
"upstream debug72 {\nserver 127.0.0.1:9172;\n}\n") "upstream debug73 {\nserver 127.0.0.1:9172;\n}\n")
if set(WOVariables.wo_hhvm).issubset(set(apt_packages)): if set(WOVariables.wo_hhvm).issubset(set(apt_packages)):
@@ -774,7 +775,7 @@ class WOStackController(CementBaseController):
# Parse /etc/php/7.2/fpm/php-fpm.conf # Parse /etc/php/7.2/fpm/php-fpm.conf
data = dict(pid="/run/php/php7.2-fpm.pid", error_log="/var/log/php/7.2/fpm.log", data = dict(pid="/run/php/php7.2-fpm.pid", error_log="/var/log/php/7.2/fpm.log",
include="/etc/php/7.2/fpm/pool.d/*.conf") include="/etc/php/7.2/fpm/pool.d/*.conf")
Log.debug(self, "writting php5 configuration into " Log.debug(self, "writting php7.2 configuration into "
"/etc/php/7.2/fpm/php-fpm.conf") "/etc/php/7.2/fpm/php-fpm.conf")
wo_php_fpm = open('/etc/php/7.2/fpm/php-fpm.conf', wo_php_fpm = open('/etc/php/7.2/fpm/php-fpm.conf',
encoding='utf-8', mode='w') encoding='utf-8', mode='w')
@@ -796,7 +797,7 @@ class WOStackController(CementBaseController):
config['www']['pm'] = 'ondemand' config['www']['pm'] = 'ondemand'
config['www']['chdir'] = '/' config['www']['chdir'] = '/'
config['www']['prefix'] = '/var/run/php' config['www']['prefix'] = '/var/run/php'
config['www']['listen'] = 'php73-fpm.sock' config['www']['listen'] = 'php72-fpm.sock'
config['www']['listen.backlog'] = '32768' config['www']['listen.backlog'] = '32768'
with codecs.open('/etc/php/7.2/fpm/pool.d/www.conf', with codecs.open('/etc/php/7.2/fpm/pool.d/www.conf',
encoding='utf-8', mode='w') as configfile: encoding='utf-8', mode='w') as configfile:
@@ -899,7 +900,7 @@ class WOStackController(CementBaseController):
# Parse /etc/php/7.3/fpm/php-fpm.conf # Parse /etc/php/7.3/fpm/php-fpm.conf
data = dict(pid="/run/php/php7.3-fpm.pid", error_log="/var/log/php7.3-fpm.log", data = dict(pid="/run/php/php7.3-fpm.pid", error_log="/var/log/php7.3-fpm.log",
include="/etc/php/7.3/fpm/pool.d/*.conf") include="/etc/php/7.3/fpm/pool.d/*.conf")
Log.debug(self, "writting php 7.0 configuration into " Log.debug(self, "writting php 7.3 configuration into "
"/etc/php/7.3/fpm/php-fpm.conf") "/etc/php/7.3/fpm/php-fpm.conf")
wo_php_fpm = open('/etc/php/7.3/fpm/php-fpm.conf', wo_php_fpm = open('/etc/php/7.3/fpm/php-fpm.conf',
encoding='utf-8', mode='w') encoding='utf-8', mode='w')
@@ -925,7 +926,7 @@ class WOStackController(CementBaseController):
config['www']['listen.backlog'] = '32768' config['www']['listen.backlog'] = '32768'
with codecs.open('/etc/php/7.3/fpm/pool.d/www.conf', with codecs.open('/etc/php/7.3/fpm/pool.d/www.conf',
encoding='utf-8', mode='w') as configfile: encoding='utf-8', mode='w') as configfile:
Log.debug(self, "writting PHP5 configuration into " Log.debug(self, "writting PHP 7.3 configuration into "
"/etc/php/7.3/fpm/pool.d/www.conf") "/etc/php/7.3/fpm/pool.d/www.conf")
config.write(configfile) config.write(configfile)
@@ -936,13 +937,13 @@ class WOStackController(CementBaseController):
"debug.conf", "[www]", "[debug]") "debug.conf", "[www]", "[debug]")
config = configparser.ConfigParser() config = configparser.ConfigParser()
config.read('/etc/php/7.3/fpm/pool.d/debug.conf') config.read('/etc/php/7.3/fpm/pool.d/debug.conf')
config['debug']['listen'] = '127.0.0.1:9182' config['debug']['listen'] = '127.0.0.1:9173'
config['debug']['rlimit_core'] = 'unlimited' config['debug']['rlimit_core'] = 'unlimited'
config['debug']['slowlog'] = '/var/log/php/7.3/slow.log' config['debug']['slowlog'] = '/var/log/php/7.3/slow.log'
config['debug']['request_slowlog_timeout'] = '10s' config['debug']['request_slowlog_timeout'] = '10s'
with open('/etc/php/7.3/fpm/pool.d/debug.conf', with open('/etc/php/7.3/fpm/pool.d/debug.conf',
encoding='utf-8', mode='w') as confifile: encoding='utf-8', mode='w') as confifile:
Log.debug(self, "writting PHP5 configuration into " Log.debug(self, "writting PHP 7.3 configuration into "
"/etc/php/7.3/fpm/pool.d/debug.conf") "/etc/php/7.3/fpm/pool.d/debug.conf")
config.write(confifile) config.write(confifile)
@@ -999,41 +1000,41 @@ class WOStackController(CementBaseController):
WOGit.add(self, ["/etc/php"], msg="Adding PHP into Git") WOGit.add(self, ["/etc/php"], msg="Adding PHP into Git")
WOService.restart_service(self, 'php7.3-fpm') WOService.restart_service(self, 'php7.3-fpm')
# preconfiguration for php7.2 # preconfiguration for php7.3
if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') and set(WOVariables.wo_php).issubset(set(apt_packages)): if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') and set(WOVariables.wo_php).issubset(set(apt_packages)):
# Create log directories # Create log directories
if not os.path.exists('/var/log/php/7.2/'): if not os.path.exists('/var/log/php/7.3/'):
Log.debug(self, 'Creating directory /var/log/php/7.2/') Log.debug(self, 'Creating directory /var/log/php/7.3/')
os.makedirs('/var/log/php/7.2/') os.makedirs('/var/log/php/7.3/')
# Parse etc/php/7.2/fpm/php.ini # Parse etc/php/7.2/fpm/php.ini
config = configparser.ConfigParser() config = configparser.ConfigParser()
Log.debug(self, "configuring php file /etc/php/7.2/fpm/php.ini") Log.debug(self, "configuring php file /etc/php/7.3/fpm/php.ini")
config.read('/etc/php/7.2/fpm/php.ini') config.read('/etc/php/7.3/fpm/php.ini')
config['PHP']['expose_php'] = 'Off' config['PHP']['expose_php'] = 'Off'
config['PHP']['post_max_size'] = '64M' config['PHP']['post_max_size'] = '64M'
config['PHP']['upload_max_filesize'] = '64M' config['PHP']['upload_max_filesize'] = '64M'
config['PHP']['max_execution_time'] = '30' config['PHP']['max_execution_time'] = '30'
config['PHP']['date.timezone'] = WOVariables.wo_timezone config['PHP']['date.timezone'] = WOVariables.wo_timezone
with open('/etc/php/7.2/fpm/php.ini', with open('/etc/php/7.3/fpm/php.ini',
encoding='utf-8', mode='w') as configfile: encoding='utf-8', mode='w') as configfile:
Log.debug(self, "Writting php configuration into " Log.debug(self, "Writting php configuration into "
"/etc/php/7.2/fpm/php.ini") "/etc/php/7.3/fpm/php.ini")
config.write(configfile) config.write(configfile)
# Parse /etc/php/7.2/fpm/php-fpm.conf # Parse /etc/php/7.2/fpm/php-fpm.conf
data = dict(pid="/run/php/php7.2-fpm.pid", error_log="/var/log/php/7.2/fpm.log", data = dict(pid="/run/php/php7.3-fpm.pid", error_log="/var/log/php/7.3/fpm.log",
include="/etc/php/7.2/fpm/pool.d/*.conf") include="/etc/php/7.3/fpm/pool.d/*.conf")
Log.debug(self, "writting php 7.0 configuration into " Log.debug(self, "writting php 7.3 configuration into "
"/etc/php/7.2/fpm/php-fpm.conf") "/etc/php/7.3/fpm/php-fpm.conf")
wo_php_fpm = open('/etc/php/7.2/fpm/php-fpm.conf', wo_php_fpm = open('/etc/php/7.3/fpm/php-fpm.conf',
encoding='utf-8', mode='w') encoding='utf-8', mode='w')
self.app.render((data), 'php-fpm.mustache', out=wo_php_fpm) self.app.render((data), 'php-fpm.mustache', out=wo_php_fpm)
wo_php_fpm.close() wo_php_fpm.close()
# Parse /etc/php/7.2/fpm/pool.d/www.conf # Parse /etc/php/7.3/fpm/pool.d/www.conf
config = configparser.ConfigParser() config = configparser.ConfigParser()
config.read_file(codecs.open('/etc/php/7.2/fpm/pool.d/www.conf', config.read_file(codecs.open('/etc/php/7.3/fpm/pool.d/www.conf',
"r", "utf8")) "r", "utf8"))
config['www']['ping.path'] = '/ping' config['www']['ping.path'] = '/ping'
config['www']['pm.status_path'] = '/status' config['www']['pm.status_path'] = '/status'
@@ -1044,31 +1045,34 @@ class WOStackController(CementBaseController):
config['www']['pm.max_spare_servers'] = '5' config['www']['pm.max_spare_servers'] = '5'
config['www']['request_terminate_timeout'] = '100' config['www']['request_terminate_timeout'] = '100'
config['www']['pm'] = 'ondemand' config['www']['pm'] = 'ondemand'
config['www']['listen'] = '127.0.0.1:9072' config['www']['chdir'] = '/'
with codecs.open('/etc/php/7.2/fpm/pool.d/www.conf', config['www']['prefix'] = '/var/run/php'
config['www']['listen'] = 'php73-fpm.sock'
config['www']['listen.backlog'] = '32768'
with codecs.open('/etc/php/7.3/fpm/pool.d/www.conf',
encoding='utf-8', mode='w') as configfile: encoding='utf-8', mode='w') as configfile:
Log.debug(self, "writting PHP5 configuration into " Log.debug(self, "writting PHP 7.3 configuration into "
"/etc/php/7.2/fpm/pool.d/www.conf") "/etc/php/7.3/fpm/pool.d/www.conf")
config.write(configfile) config.write(configfile)
# Generate /etc/php/7.2/fpm/pool.d/debug.conf # Generate /etc/php/7.3/fpm/pool.d/debug.conf
WOFileUtils.copyfile(self, "/etc/php/7.2/fpm/pool.d/www.conf", WOFileUtils.copyfile(self, "/etc/php/7.3/fpm/pool.d/www.conf",
"/etc/php/7.2/fpm/pool.d/debug.conf") "/etc/php/7.3/fpm/pool.d/debug.conf")
WOFileUtils.searchreplace(self, "/etc/php/7.2/fpm/pool.d/" WOFileUtils.searchreplace(self, "/etc/php/7.3/fpm/pool.d/"
"debug.conf", "[www]", "[debug]") "debug.conf", "[www]", "[debug]")
config = configparser.ConfigParser() config = configparser.ConfigParser()
config.read('/etc/php/7.2/fpm/pool.d/debug.conf') config.read('/etc/php/7.3/fpm/pool.d/debug.conf')
config['debug']['listen'] = '127.0.0.1:9172' config['debug']['listen'] = '127.0.0.1:9173'
config['debug']['rlimit_core'] = 'unlimited' config['debug']['rlimit_core'] = 'unlimited'
config['debug']['slowlog'] = '/var/log/php/7.2/slow.log' config['debug']['slowlog'] = '/var/log/php/7.3/slow.log'
config['debug']['request_slowlog_timeout'] = '10s' config['debug']['request_slowlog_timeout'] = '10s'
with open('/etc/php/7.2/fpm/pool.d/debug.conf', with open('/etc/php/7.3/fpm/pool.d/debug.conf',
encoding='utf-8', mode='w') as confifile: encoding='utf-8', mode='w') as confifile:
Log.debug(self, "writting PHP5 configuration into " Log.debug(self, "writting PHP 7.3 configuration into "
"/etc/php/7.2/fpm/pool.d/debug.conf") "/etc/php/7.3/fpm/pool.d/debug.conf")
config.write(confifile) config.write(confifile)
with open("/etc/php/7.2/fpm/pool.d/debug.conf", with open("/etc/php/7.3/fpm/pool.d/debug.conf",
encoding='utf-8', mode='a') as myfile: encoding='utf-8', mode='a') as myfile:
myfile.write("php_admin_value[xdebug.profiler_output_dir] " myfile.write("php_admin_value[xdebug.profiler_output_dir] "
"= /tmp/ \nphp_admin_value[xdebug.profiler_" "= /tmp/ \nphp_admin_value[xdebug.profiler_"
@@ -1078,8 +1082,8 @@ class WOStackController(CementBaseController):
"profiler_enable] = off\n") "profiler_enable] = off\n")
# Disable xdebug # Disable xdebug
if not WOShellExec.cmd_exec(self, "grep -q \';zend_extension\' /etc/php/7.2/mods-available/xdebug.ini"): if not WOShellExec.cmd_exec(self, "grep -q \';zend_extension\' /etc/php/7.3/mods-available/xdebug.ini"):
WOFileUtils.searchreplace(self, "/etc/php/7.2/mods-available/" WOFileUtils.searchreplace(self, "/etc/php/7.3/mods-available/"
"xdebug.ini", "xdebug.ini",
"zend_extension", "zend_extension",
";zend_extension") ";zend_extension")
@@ -1119,7 +1123,7 @@ class WOStackController(CementBaseController):
WOVariables.wo_php_user, recursive=True) WOVariables.wo_php_user, recursive=True)
WOGit.add(self, ["/etc/php"], msg="Adding PHP into Git") WOGit.add(self, ["/etc/php"], msg="Adding PHP into Git")
WOService.restart_service(self, 'php7.2-fpm') WOService.restart_service(self, 'php7.3-fpm')
if set(WOVariables.wo_mysql).issubset(set(apt_packages)): if set(WOVariables.wo_mysql).issubset(set(apt_packages)):
if not os.path.isfile("/etc/mysql/my.cnf"): if not os.path.isfile("/etc/mysql/my.cnf"):
@@ -1147,9 +1151,9 @@ class WOStackController(CementBaseController):
WOService.reload_service(self, 'mysql') WOService.reload_service(self, 'mysql')
if len(packages): if len(packages):
if any('/usr/bin/wp' == x[1] for x in packages): if any('/usr/local/bin/wp' == x[1] for x in packages):
Log.debug(self, "Setting Privileges to /usr/bin/wp file ") Log.debug(self, "Setting Privileges to /usr/local/bin/wp file ")
WOFileUtils.chmod(self, "/usr/bin/wp", 0o775) WOFileUtils.chmod(self, "/usr/local/bin/wp", 0o775)
if any('/tmp/pma.tar.gz' == x[1] if any('/tmp/pma.tar.gz' == x[1]
for x in packages): for x in packages):
@@ -1175,7 +1179,7 @@ class WOStackController(CementBaseController):
.format(WOVariables.wo_webroot)) .format(WOVariables.wo_webroot))
blowfish_key = ''.join([random.choice blowfish_key = ''.join([random.choice
(string.ascii_letters + string.digits) (string.ascii_letters + string.digits)
for n in range(10)]) for n in range(25)])
WOFileUtils.searchreplace(self, WOFileUtils.searchreplace(self,
'{0}22222/htdocs/db/pma/config.inc.php' '{0}22222/htdocs/db/pma/config.inc.php'
.format(WOVariables.wo_webroot), .format(WOVariables.wo_webroot),
@@ -1398,7 +1402,7 @@ class WOStackController(CementBaseController):
if self.app.pargs.php: if self.app.pargs.php:
Log.debug(self, "Setting apt_packages variable for PHP 7.2") Log.debug(self, "Setting apt_packages variable for PHP 7.2")
if not (WOAptGet.is_installed(self, 'php5-fpm') or WOAptGet.is_installed(self, 'php7.2-fpm')): if not (WOAptGet.is_installed(self, 'php7.2-fpm') or WOAptGet.is_installed(self, 'php7.2-fpm')):
if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'):
apt_packages = apt_packages + WOVariables.wo_php + WOVariables.wo_php_extra apt_packages = apt_packages + WOVariables.wo_php + WOVariables.wo_php_extra
else: else:
@@ -1413,7 +1417,7 @@ class WOStackController(CementBaseController):
Log.debug(self, "Setting apt_packages variable for PHP 7.3") Log.debug(self, "Setting apt_packages variable for PHP 7.3")
if not WOAptGet.is_installed(self, 'php7.3-fpm'): if not WOAptGet.is_installed(self, 'php7.3-fpm'):
apt_packages = apt_packages + WOVariables.wo_php73 apt_packages = apt_packages + WOVariables.wo_php73
if not WOAptGet.is_installed(self, 'php5-fpm'): if not WOAptGet.is_installed(self, 'php7.2-fpm'):
apt_packages = apt_packages + WOVariables.wo_php apt_packages = apt_packages + WOVariables.wo_php
else: else:
Log.debug(self, "PHP 7.3 already installed") Log.debug(self, "PHP 7.3 already installed")
@@ -1429,6 +1433,8 @@ class WOStackController(CementBaseController):
Log.debug(self, "Setting apt_packages variable for PHP 7.3") Log.debug(self, "Setting apt_packages variable for PHP 7.3")
if not WOAptGet.is_installed(self, 'php7.3-fpm'): if not WOAptGet.is_installed(self, 'php7.3-fpm'):
apt_packages = apt_packages + WOVariables.wo_php73 + WOVariables.wo_php_extra apt_packages = apt_packages + WOVariables.wo_php73 + WOVariables.wo_php_extra
if not WOAptGet.is_installed(self, 'php7.2-fpm'):
apt_packages = apt_packages + WOVariables.wo_php + WOVariables.wo_php_extra
else: else:
Log.debug(self, "PHP 7.3 already installed") Log.debug(self, "PHP 7.3 already installed")
Log.info(self, "PHP 7.3 already installed") Log.info(self, "PHP 7.3 already installed")
@@ -1640,7 +1646,7 @@ class WOStackController(CementBaseController):
Log.debug(self, "Removing apt_packages variable of PHP") Log.debug(self, "Removing apt_packages variable of PHP")
if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'):
apt_packages = apt_packages + WOVariables.wo_php apt_packages = apt_packages + WOVariables.wo_php
if not WOAptGet.is_installed(self, 'php7.2-fpm'): if not WOAptGet.is_installed(self, 'php7.3-fpm'):
apt_packages = apt_packages + WOVariables.wo_php_extra apt_packages = apt_packages + WOVariables.wo_php_extra
else: else:
apt_packages = apt_packages + WOVariables.wo_php apt_packages = apt_packages + WOVariables.wo_php
@@ -1650,7 +1656,7 @@ class WOStackController(CementBaseController):
if (WOVariables.wo_platform_codename == 'jessie'): if (WOVariables.wo_platform_codename == 'jessie'):
Log.debug(self, "Removing apt_packages variable of PHP 7.3") Log.debug(self, "Removing apt_packages variable of PHP 7.3")
apt_packages = apt_packages + WOVariables.wo_php73 apt_packages = apt_packages + WOVariables.wo_php73
if not WOAptGet.is_installed(self, 'php7.3-fpm'): if not WOAptGet.is_installed(self, 'php7.2-fpm'):
apt_packages = apt_packages + WOVariables.wo_php_extra apt_packages = apt_packages + WOVariables.wo_php_extra
else: else:
Log.info(self, "PHP 7.3 not supported.") Log.info(self, "PHP 7.3 not supported.")
@@ -1659,7 +1665,7 @@ class WOStackController(CementBaseController):
if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'):
Log.debug(self, "Removing apt_packages variable of PHP 7.3") Log.debug(self, "Removing apt_packages variable of PHP 7.3")
apt_packages = apt_packages + WOVariables.wo_php73 apt_packages = apt_packages + WOVariables.wo_php73
if not WOAptGet.is_installed(self, 'php7.3-fpm'): if not WOAptGet.is_installed(self, 'php7.2-fpm'):
apt_packages = apt_packages + WOVariables.wo_php_extra apt_packages = apt_packages + WOVariables.wo_php_extra
else: else:
Log.info(self, "PHP 7.3 not supported.") Log.info(self, "PHP 7.3 not supported.")
@@ -1788,9 +1794,11 @@ class WOStackController(CementBaseController):
if self.app.pargs.php: if self.app.pargs.php:
Log.debug(self, "Purge apt_packages variable PHP") Log.debug(self, "Purge apt_packages variable PHP")
if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'):
apt_packages = apt_packages + WOVariables.wo_php_extra apt_packages = apt_packages + WOVariables.wo_php
if not WOAptGet.is_installed(self, 'php7.3-fpm'):
apt_packages = apt_packages + WOVariables.wo_php_extra
else: else:
apt_packages = apt_packages + WOVariables.wo_php73 apt_packages = apt_packages + WOVariables.wo_php
# For debian --php73 # For debian --php73
if self.app.pargs.php73: if self.app.pargs.php73:
@@ -1806,7 +1814,7 @@ class WOStackController(CementBaseController):
if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'):
Log.debug(self, "Removing apt_packages variable of PHP 7.3") Log.debug(self, "Removing apt_packages variable of PHP 7.3")
apt_packages = apt_packages + WOVariables.wo_php73 apt_packages = apt_packages + WOVariables.wo_php73
if not WOAptGet.is_installed(self, 'php7.3-fpm'): if not WOAptGet.is_installed(self, 'php7.2-fpm'):
apt_packages = apt_packages + WOVariables.wo_php_extra apt_packages = apt_packages + WOVariables.wo_php_extra
else: else:
Log.info(self, "PHP 7.3 not supported.") Log.info(self, "PHP 7.3 not supported.")
@@ -1814,14 +1822,7 @@ class WOStackController(CementBaseController):
if WOAptGet.is_installed(self, 'hhvm'): if WOAptGet.is_installed(self, 'hhvm'):
Log.debug(self, "Purge apt_packages varible of HHVM") Log.debug(self, "Purge apt_packages varible of HHVM")
apt_packages = apt_packages + WOVariables.wo_hhvm apt_packages = apt_packages + WOVariables.wo_hhvm
if self.app.pargs.redis:
Log.debug(self, "Purge apt_packages variable of Redis")
apt_packages = apt_packages + WOVariables.wo_redis
if self.app.pargs.mysql:
Log.debug(self, "Purge apt_packages variable MySQL")
apt_packages = apt_packages + WOVariables.wo_mysql
packages = packages + ['/usr/bin/mysqltuner']
if self.app.pargs.wpcli:
Log.debug(self, "Purge package variable WPCLI") Log.debug(self, "Purge package variable WPCLI")
if os.path.isfile('/usr/bin/wp'): if os.path.isfile('/usr/bin/wp'):
packages = packages + ['/usr/bin/wp'] packages = packages + ['/usr/bin/wp']
@@ -1880,8 +1881,8 @@ class WOStackController(CementBaseController):
# Added for php Ondrej repo missing package fix # Added for php Ondrej repo missing package fix
if self.app.pargs.php73: if self.app.pargs.php73:
if WOAptGet.is_installed(self, 'php7.3-fpm'): if WOAptGet.is_installed(self, 'php7.2-fpm'):
Log.info(self, "PHP7.3-fpm found on system.") Log.info(self, "PHP7.2-fpm found on system.")
Log.info( Log.info(
self, "Verifying and installing missing packages,") self, "Verifying and installing missing packages,")
WOShellExec.cmd_exec( WOShellExec.cmd_exec(

View File

@@ -46,10 +46,10 @@ class WOStackStatusController(CementBaseController):
else: else:
Log.info(self, "PHP7.2-FPM is not installed") Log.info(self, "PHP7.2-FPM is not installed")
if WOAptGet.is_installed(self, 'php7.2-fpm'): if WOAptGet.is_installed(self, 'php7.3-fpm'):
services = services + ['php7.2-fpm'] services = services + ['php7.3-fpm']
else: else:
Log.info(self, "PHP7.2-FPM is not installed") Log.info(self, "PHP7.3-FPM is not installed")
if self.app.pargs.php73: if self.app.pargs.php73:
if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'):
@@ -116,17 +116,17 @@ class WOStackStatusController(CementBaseController):
if WOAptGet.is_installed(self, 'php7.2-fpm'): if WOAptGet.is_installed(self, 'php7.2-fpm'):
services = services + ['php7.2-fpm'] services = services + ['php7.2-fpm']
else: else:
Log.info(self, "PHP5-FPM is not installed") Log.info(self, "PHP7.2-FPM is not installed")
else: else:
if WOAptGet.is_installed(self, 'php7.2-fpm'): if WOAptGet.is_installed(self, 'php7.2-fpm'):
services = services + ['php7.2-fpm'] services = services + ['php7.2-fpm']
else: else:
Log.info(self, "PHP7.2-FPM is not installed") Log.info(self, "PHP7.2-FPM is not installed")
if WOAptGet.is_installed(self, 'php7.2-fpm'): if WOAptGet.is_installed(self, 'php7.3-fpm'):
services = services + ['php7.2-fpm'] services = services + ['php7.3-fpm']
else: else:
Log.info(self, "PHP7.2-FPM is not installed") Log.info(self, "PHP7.3-FPM is not installed")
if self.app.pargs.php73: if self.app.pargs.php73:
if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'):
@@ -200,10 +200,10 @@ class WOStackStatusController(CementBaseController):
else: else:
Log.info(self, "PHP7.2-FPM is not installed") Log.info(self, "PHP7.2-FPM is not installed")
if WOAptGet.is_installed(self, 'php7.2-fpm'): if WOAptGet.is_installed(self, 'php7.3-fpm'):
services = services + ['php7.2-fpm'] services = services + ['php7.3-fpm']
else: else:
Log.info(self, "PHP7.2-FPM is not installed") Log.info(self, "PHP7.3-FPM is not installed")
if self.app.pargs.php73: if self.app.pargs.php73:
if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'):
@@ -278,10 +278,10 @@ class WOStackStatusController(CementBaseController):
else: else:
Log.info(self, "PHP7.2-FPM is not installed") Log.info(self, "PHP7.2-FPM is not installed")
if WOAptGet.is_installed(self, 'php7.2-fpm'): if WOAptGet.is_installed(self, 'php7.3-fpm'):
services = services + ['php7.2-fpm'] services = services + ['php7.3-fpm']
else: else:
Log.info(self, "PHP7.2-FPM is not installed") Log.info(self, "PHP7.3-FPM is not installed")
if self.app.pargs.php73: if self.app.pargs.php73:
if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'):
@@ -355,10 +355,10 @@ class WOStackStatusController(CementBaseController):
else: else:
Log.info(self, "php7.2-fpm is not installed") Log.info(self, "php7.2-fpm is not installed")
if WOAptGet.is_installed(self, 'php7.2-fpm'): if WOAptGet.is_installed(self, 'php7.3-fpm'):
services = services + ['php7.2-fpm'] services = services + ['php7.3-fpm']
else: else:
Log.info(self, "PHP7.2-FPM is not installed") Log.info(self, "PHP7.3-FPM is not installed")
if self.app.pargs.php73: if self.app.pargs.php73:
if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'):
@@ -367,7 +367,7 @@ class WOStackStatusController(CementBaseController):
else: else:
Log.info(self, "PHP7.3-FPM is not installed") Log.info(self, "PHP7.3-FPM is not installed")
else: else:
Log.info(self, "Your platform does not support PHP 7") Log.info(self, "Your platform does not support PHP 7.3")
if self.app.pargs.mysql: if self.app.pargs.mysql:
if ((WOVariables.wo_mysql_host is "localhost") or if ((WOVariables.wo_mysql_host is "localhost") or

View File

@@ -89,8 +89,8 @@ class WOStackUpgradeController(CementBaseController):
if ((not self.app.pargs.web) and (not self.app.pargs.nginx) and if ((not self.app.pargs.web) and (not self.app.pargs.nginx) and
(not self.app.pargs.php) and (not self.app.pargs.mysql) and (not self.app.pargs.php) and (not self.app.pargs.mysql) and
(not self.app.pargs.hhvm) and (not self.app.pargs.all) and (not self.app.pargs.hhvm) and (not self.app.pargs.all) and
(not self.app.pargs.wpcli) and (not self.app.pargs.redis) and (not self.app.pargs.wpcli) and (not self.app.pargs.redis) and
(not self.app.pargs.nginxmainline)): (not self.app.pargs.nginxmainline)):
self.app.pargs.web = True self.app.pargs.web = True
@@ -178,13 +178,13 @@ class WOStackUpgradeController(CementBaseController):
if len(packages): if len(packages):
if self.app.pargs.wpcli: if self.app.pargs.wpcli:
WOFileUtils.remove(self,['/usr/bin/wp']) WOFileUtils.remove(self,['/usr/local/bin/wp'])
Log.debug(self, "Downloading following: {0}".format(packages)) Log.debug(self, "Downloading following: {0}".format(packages))
WODownload.download(self, packages) WODownload.download(self, packages)
if self.app.pargs.wpcli: if self.app.pargs.wpcli:
WOFileUtils.chmod(self, "/usr/bin/wp", 0o775) WOFileUtils.chmod(self, "/usr/local/bin/wp", 0o775)
Log.info(self, "Successfully updated packages") Log.info(self, "Successfully updated packages")
else: else:

View File

@@ -39,6 +39,6 @@ server {
location ~ \.php$ { location ~ \.php$ {
try_files $uri =404; try_files $uri =404;
include fastcgi_params; include fastcgi_params;
fastcgi_pass php; fastcgi_pass php72;
} }
} }

View File

@@ -59,7 +59,7 @@ location = /nginx_status {
} }
location ~ ^/(status|ping)$ { location ~ ^/(status|ping)$ {
include fastcgi_params; include fastcgi_params;
fastcgi_pass php7; fastcgi_pass php73;
include common/acl.conf; include common/acl.conf;
} }
# WordOps (wo) utilities # WordOps (wo) utilities

View File

@@ -59,7 +59,7 @@ location = /nginx_status {
} }
location ~ ^/(status|ping)$ { location ~ ^/(status|ping)$ {
include fastcgi_params; include fastcgi_params;
fastcgi_pass php; fastcgi_pass php72;
include common/acl.conf; include common/acl.conf;
} }
# WordOps (wo) utilities # WordOps (wo) utilities

View File

@@ -4,7 +4,7 @@ server 127.0.0.1:9000;
} }
upstream debug { upstream debug {
# Debug Pool # Debug Pool
server 127.0.0.1:9100; server 127.0.0.1:9001;
} }
upstream php72 { upstream php72 {
server unix:/var/run/php/php72-fpm.sock; server unix:/var/run/php/php72-fpm.sock;

View File

@@ -4,7 +4,7 @@
location = /wp-login.php { location = /wp-login.php {
limit_req zone=one burst=1 nodelay; limit_req zone=one burst=1 nodelay;
include fastcgi_params; include fastcgi_params;
fastcgi_pass php; fastcgi_pass php72;
} }
# Disable wp-config.txt # Disable wp-config.txt
location = /wp-config.txt { location = /wp-config.txt {

View File

@@ -1,28 +1,11 @@
# WPFC NGINX CONFIGURATION # WPFC NGINX CONFIGURATION
# DO NOT MODIFY, ALL CHANGES WILL BE LOST AFTER AN WordOps (wo) UPDATE # DO NOT MODIFY, ALL CHANGES WILL BE LOST AFTER AN WordOps (wo) UPDATE
set $skip_cache 0; # $skip_cache variable set in /etc/nginx/conf.d/map-wp-fastcgi-cache.conf
# POST requests and URL with a query string should always go to php
if ($request_method = POST) {
set $skip_cache 1;
}
if ($query_string != "") {
set $skip_cache 1;
}
# Don't cache URL containing the following segments
if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|wp-.*\.php|index.php|/feed/|.*sitemap.*\.xml)") {
set $skip_cache 1;
}
# Don't use the cache for logged in users or recent commenter or customer with items in cart
if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in|[a-z0-9]+_items_in_cart") {
set $skip_cache 1;
}
# Use cached or actual file if they exists, Otherwise pass request to WordPress # Use cached or actual file if they exists, Otherwise pass request to WordPress
location / { location / {
try_files $uri $uri/ /index.php$is_args$args; try_files $uri $uri/ /index.php$is_args$args;
} }
location ~ ^/wp-content/cache/minify/(.+\.(css|js))$ {
try_files $uri /wp-content/plugins/w3-total-cache/pub/minify.php?file=$1;
}
location ~ \.php$ { location ~ \.php$ {
try_files $uri =404; try_files $uri =404;
include fastcgi_params; include fastcgi_params;

View File

@@ -1,28 +1,11 @@
# WPFC NGINX CONFIGURATION # WPFC NGINX CONFIGURATION
# DO NOT MODIFY, ALL CHANGES WILL BE LOST AFTER AN WordOps (wo) UPDATE # DO NOT MODIFY, ALL CHANGES WILL BE LOST AFTER AN WordOps (wo) UPDATE
set $skip_cache 0; # $skip_cache variable set in /etc/nginx/conf.d/map-wp-fastcgi-cache.conf
# POST requests and URL with a query string should always go to php
if ($request_method = POST) {
set $skip_cache 1;
}
if ($query_string != "") {
set $skip_cache 1;
}
# Don't cache URL containing the following segments
if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|wp-.*\.php|index.php|/feed/|.*sitemap.*\.xml)") {
set $skip_cache 1;
}
# Don't use the cache for logged in users or recent commenter or customer with items in cart
if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in|[a-z0-9]+_items_in_cart") {
set $skip_cache 1;
}
# Use cached or actual file if they exists, Otherwise pass request to WordPress # Use cached or actual file if they exists, Otherwise pass request to WordPress
location / { location / {
try_files $uri $uri/ /index.php$is_args$args; try_files $uri $uri/ /index.php$is_args$args;
} }
location ~ ^/wp-content/cache/minify/(.+\.(css|js))$ {
try_files $uri /wp-content/plugins/w3-total-cache/pub/minify.php?file=$1;
}
location ~ \.php$ { location ~ \.php$ {
try_files $uri =404; try_files $uri =404;
include fastcgi_params; include fastcgi_params;

View File

@@ -121,13 +121,13 @@ class WOVariables():
"php7.2-common", "php7.2-readline", "php-redis", "php7.2-common", "php7.2-readline", "php-redis",
"php7.2-mysql", "php7.2-cli", "php-imagick", "php7.2-mysql", "php7.2-cli", "php-imagick",
"php7.2-mbstring", "php7.2-recode", "php7.2-bcmath", "php7.2-opcache", "php7.2-zip", "php7.2-xml", "php7.2-mbstring", "php7.2-recode", "php7.2-bcmath", "php7.2-opcache", "php7.2-zip", "php7.2-xml",
"php7.2-soap", "php7.2-msgpack", "php7.2-soap", "php-msgpack",
"graphviz", "php-pear", "php-xdebug"] "graphviz", "php-pear", "php-xdebug"]
wo_php73 = ["php7.3-fpm", "php7.3-curl", "php7.3-gd", "php7.3-imap", wo_php73 = ["php7.3-fpm", "php7.3-curl", "php7.3-gd", "php7.3-imap",
"php7.3-common", "php7.3-readline", "php-redis", "php7.3-common", "php7.3-readline", "php-redis",
"php7.3-mysql", "php7.3-cli", "php-imagick", "php7.3-mysql", "php7.3-cli", "php-imagick",
"php7.3-mbstring", "php7.3-recode", "php7.3-bcmath", "php7.3-opcache", "php7.3-zip", "php7.3-xml", "php7.3-mbstring", "php7.3-recode", "php7.3-bcmath", "php7.3-opcache", "php7.3-zip", "php7.3-xml",
"php7.3-soap", "php7.3-msgpack", "php7.3-soap", "php-msgpack",
"graphviz", "php-pear", "php-xdebug"] "graphviz", "php-pear", "php-xdebug"]
wo_php_extra = [] wo_php_extra = []