@@ -209,6 +209,13 @@ def pre_pref(self, apt_packages):
209209 Log .debug (self , 'Adding ppa for PHP' )
210210 EERepo .add (self , ppa = EEVariables .ee_php_repo )
211211
212+ if EEVariables .ee_platform_codename == 'jessie' :
213+ if set (EEVariables .ee_php7_0 ).issubset (set (apt_packages )):
214+ Log .debug (self , 'Adding repo_url of php 7.0 for debian' )
215+ EERepo .add (self , repo_url = EEVariables .ee_php_repo )
216+ Log .debug (self , 'Adding Dotdeb/php GPG key' )
217+ EERepo .add_key (self , '89DF5277' )
218+
212219 if set (EEVariables .ee_hhvm ).issubset (set (apt_packages )):
213220 if EEVariables .ee_platform_codename != 'xenial' :
214221 Log .info (self , "Adding repository for HHVM, please wait..." )
@@ -391,7 +398,7 @@ def post_pref(self, apt_packages, packages):
391398 ee_nginx .close ()
392399
393400 #php7 conf
394- if (EEVariables .ee_platform_codename == 'trusty' or EEVariables .ee_platform_codename == 'xenial' ) and (not
401+ if (EEVariables .ee_platform_codename == 'jessie' or EEVariables . ee_platform_codename == ' trusty' or EEVariables .ee_platform_codename == 'xenial' ) and (not
395402 os .path .isfile ("/etc/nginx/common/php7.conf" )):
396403 #data = dict()
397404 Log .debug (self , 'Writting the nginx configuration to '
@@ -1156,9 +1163,9 @@ def post_pref(self, apt_packages, packages):
11561163 EEGit .add (self , ["/etc/php" ], msg = "Adding PHP into Git" )
11571164 EEService .restart_service (self , 'php5.6-fpm' )
11581165
1159- #preconfiguration for php7.0
1160- if (EEVariables .ee_platform_codename == 'trusty' or EEVariables . ee_platform_codename == 'xenial' ) and set (EEVariables .ee_php7_0 ).issubset (set (apt_packages )):
1161- # Create log directories
1166+ #PHP7.0 configuration for debian
1167+ if (EEVariables .ee_platform_codename == 'jessie' ) and set (EEVariables .ee_php7_0 ).issubset (set (apt_packages )):
1168+ # Create log directories
11621169 if not os .path .exists ('/var/log/php/7.0/' ):
11631170 Log .debug (self , 'Creating directory /var/log/php/7.0/' )
11641171 os .makedirs ('/var/log/php/7.0/' )
@@ -1179,23 +1186,128 @@ def post_pref(self, apt_packages, packages):
11791186 config .write (configfile )
11801187
11811188 # Parse /etc/php/7.0/fpm/php-fpm.conf
1182- '''
1183- #Depreciated code. Mustache version applied
1189+ data = dict (pid = "/run/php/php7.0-fpm.pid" , error_log = "/var/log/php7.0-fpm.log" ,
1190+ include = "/etc/php/7.0/fpm/pool.d/*.conf" )
1191+ Log .debug (self , "writting php 7.0 configuration into "
1192+ "/etc/php/7.0/fpm/php-fpm.conf" )
1193+ ee_php_fpm = open ('/etc/php/7.0/fpm/php-fpm.conf' ,
1194+ encoding = 'utf-8' , mode = 'w' )
1195+ self .app .render ((data ), 'php-fpm.mustache' , out = ee_php_fpm )
1196+ ee_php_fpm .close ()
1197+
1198+ # Parse /etc/php/7.0/fpm/pool.d/www.conf
11841199 config = configparser .ConfigParser ()
1185- Log.debug(self, "configuring php file"
1186- "/etc/php/7.0/fpm/php-fpm.conf")
1187- config.read_file(codecs.open("/etc/php/7.0/fpm/php-fpm.conf",
1200+ config .read_file (codecs .open ('/etc/php/7.0/fpm/pool.d/www.conf' ,
11881201 "r" , "utf8" ))
1189- config['global']['error_log'] = '/var/log/php/7.0/fpm.log'
1190- config.remove_option('global', 'include')
1191- config['global']['log_level'] = 'notice'
1192- config['global']['include'] = '/etc/php/7.0/fpm/pool.d/*.conf'
1193- with codecs.open('/etc/php/7.0/fpm/php-fpm.conf',
1202+ config ['www' ]['ping.path' ] = '/ping'
1203+ config ['www' ]['pm.status_path' ] = '/status'
1204+ config ['www' ]['pm.max_requests' ] = '500'
1205+ config ['www' ]['pm.max_children' ] = '100'
1206+ config ['www' ]['pm.start_servers' ] = '20'
1207+ config ['www' ]['pm.min_spare_servers' ] = '10'
1208+ config ['www' ]['pm.max_spare_servers' ] = '30'
1209+ config ['www' ]['request_terminate_timeout' ] = '300'
1210+ config ['www' ]['pm' ] = 'ondemand'
1211+ config ['www' ]['listen' ] = '127.0.0.1:9070'
1212+ with codecs .open ('/etc/php/7.0/fpm/pool.d/www.conf' ,
11941213 encoding = 'utf-8' , mode = 'w' ) as configfile :
1195- Log.debug(self, "writting php5 configuration into "
1196- "/etc/php/7.0/fpm/php-fpm .conf")
1214+ Log .debug (self , "writting PHP5 configuration into "
1215+ "/etc/php/7.0/fpm/pool.d/www .conf" )
11971216 config .write (configfile )
1198- '''
1217+
1218+ # Generate /etc/php/7.0/fpm/pool.d/debug.conf
1219+ EEFileUtils .copyfile (self , "/etc/php/7.0/fpm/pool.d/www.conf" ,
1220+ "/etc/php/7.0/fpm/pool.d/debug.conf" )
1221+ EEFileUtils .searchreplace (self , "/etc/php/7.0/fpm/pool.d/"
1222+ "debug.conf" , "[www]" , "[debug]" )
1223+ config = configparser .ConfigParser ()
1224+ config .read ('/etc/php/7.0/fpm/pool.d/debug.conf' )
1225+ config ['debug' ]['listen' ] = '127.0.0.1:9170'
1226+ config ['debug' ]['rlimit_core' ] = 'unlimited'
1227+ config ['debug' ]['slowlog' ] = '/var/log/php/7.0/slow.log'
1228+ config ['debug' ]['request_slowlog_timeout' ] = '10s'
1229+ with open ('/etc/php/7.0/fpm/pool.d/debug.conf' ,
1230+ encoding = 'utf-8' , mode = 'w' ) as confifile :
1231+ Log .debug (self , "writting PHP5 configuration into "
1232+ "/etc/php/7.0/fpm/pool.d/debug.conf" )
1233+ config .write (confifile )
1234+
1235+ with open ("/etc/php/7.0/fpm/pool.d/debug.conf" ,
1236+ encoding = 'utf-8' , mode = 'a' ) as myfile :
1237+ myfile .write ("php_admin_value[xdebug.profiler_output_dir] "
1238+ "= /tmp/ \n php_admin_value[xdebug.profiler_"
1239+ "output_name] = cachegrind.out.%p-%H-%R "
1240+ "\n php_admin_flag[xdebug.profiler_enable"
1241+ "_trigger] = on \n php_admin_flag[xdebug."
1242+ "profiler_enable] = off\n " )
1243+
1244+ # Disable xdebug
1245+ if not EEShellExec .cmd_exec (self , "grep -q \' ;zend_extension\' /etc/php/mods-available/xdebug.ini" ):
1246+ EEFileUtils .searchreplace (self , "/etc/php/mods-available/"
1247+ "xdebug.ini" ,
1248+ "zend_extension" ,
1249+ ";zend_extension" )
1250+
1251+ # PHP and Debug pull configuration
1252+ if not os .path .exists ('{0}22222/htdocs/fpm/status/'
1253+ .format (EEVariables .ee_webroot )):
1254+ Log .debug (self , 'Creating directory '
1255+ '{0}22222/htdocs/fpm/status/ '
1256+ .format (EEVariables .ee_webroot ))
1257+ os .makedirs ('{0}22222/htdocs/fpm/status/'
1258+ .format (EEVariables .ee_webroot ))
1259+ open ('{0}22222/htdocs/fpm/status/debug'
1260+ .format (EEVariables .ee_webroot ),
1261+ encoding = 'utf-8' , mode = 'a' ).close ()
1262+ open ('{0}22222/htdocs/fpm/status/php'
1263+ .format (EEVariables .ee_webroot ),
1264+ encoding = 'utf-8' , mode = 'a' ).close ()
1265+
1266+ # Write info.php
1267+ if not os .path .exists ('{0}22222/htdocs/php/'
1268+ .format (EEVariables .ee_webroot )):
1269+ Log .debug (self , 'Creating directory '
1270+ '{0}22222/htdocs/php/ '
1271+ .format (EEVariables .ee_webroot ))
1272+ os .makedirs ('{0}22222/htdocs/php'
1273+ .format (EEVariables .ee_webroot ))
1274+
1275+ with open ("{0}22222/htdocs/php/info.php"
1276+ .format (EEVariables .ee_webroot ),
1277+ encoding = 'utf-8' , mode = 'w' ) as myfile :
1278+ myfile .write ("<?php\n phpinfo();\n ?>" )
1279+
1280+ EEFileUtils .chown (self , "{0}22222"
1281+ .format (EEVariables .ee_webroot ),
1282+ EEVariables .ee_php_user ,
1283+ EEVariables .ee_php_user , recursive = True )
1284+
1285+ EEGit .add (self , ["/etc/php" ], msg = "Adding PHP into Git" )
1286+ EEService .restart_service (self , 'php7.0-fpm' )
1287+
1288+ #preconfiguration for php7.0
1289+ if (EEVariables .ee_platform_codename == 'trusty' or EEVariables .ee_platform_codename == 'xenial' ) and set (EEVariables .ee_php7_0 ).issubset (set (apt_packages )):
1290+ # Create log directories
1291+ if not os .path .exists ('/var/log/php/7.0/' ):
1292+ Log .debug (self , 'Creating directory /var/log/php/7.0/' )
1293+ os .makedirs ('/var/log/php/7.0/' )
1294+
1295+ # Parse etc/php/7.0/fpm/php.ini
1296+ config = configparser .ConfigParser ()
1297+ Log .debug (self , "configuring php file /etc/php/7.0/fpm/php.ini" )
1298+ config .read ('/etc/php/7.0/fpm/php.ini' )
1299+ config ['PHP' ]['expose_php' ] = 'Off'
1300+ config ['PHP' ]['post_max_size' ] = '100M'
1301+ config ['PHP' ]['upload_max_filesize' ] = '100M'
1302+ config ['PHP' ]['max_execution_time' ] = '300'
1303+ config ['PHP' ]['date.timezone' ] = EEVariables .ee_timezone
1304+ with open ('/etc/php/7.0/fpm/php.ini' ,
1305+ encoding = 'utf-8' , mode = 'w' ) as configfile :
1306+ Log .debug (self , "Writting php configuration into "
1307+ "/etc/php/7.0/fpm/php.ini" )
1308+ config .write (configfile )
1309+
1310+ # Parse /etc/php/7.0/fpm/php-fpm.conf
11991311 data = dict (pid = "/run/php/php7.0-fpm.pid" , error_log = "/var/log/php/7.0/fpm.log" ,
12001312 include = "/etc/php/7.0/fpm/pool.d/*.conf" )
12011313 Log .debug (self , "writting php 7.0 configuration into "
@@ -2260,6 +2372,21 @@ def install(self, packages=[], apt_packages=[], disp_msg=True):
22602372 Log .debug (self , "PHP already installed" )
22612373 Log .info (self , "PHP already installed" )
22622374
2375+ #PHP 7.0 for Debian (jessie+)
2376+ if self .app .pargs .php7 :
2377+ if (EEVariables .ee_platform_codename == 'jessie' ):
2378+ Log .debug (self , "Setting apt_packages variable for PHP 7.0" )
2379+ if not EEAptGet .is_installed (self , 'php7.0-fpm' ) :
2380+ apt_packages = apt_packages + EEVariables .ee_php7_0
2381+ if not EEAptGet .is_installed (self , 'php5-fpm' ):
2382+ apt_packages = apt_packages + EEVariables .ee_php
2383+ else :
2384+ Log .debug (self , "PHP 7.0 already installed" )
2385+ Log .info (self , "PHP 7.0 already installed" )
2386+ else :
2387+ Log .debug (self , "PHP 7.0 Not Available for your Distribution" )
2388+ Log .info (self , "PHP 7.0 Not Available for your Distribution" )
2389+
22632390
22642391 if self .app .pargs .php7 :
22652392 if (EEVariables .ee_platform_codename == 'trusty' or EEVariables .ee_platform_codename == 'xenial' ):
@@ -2533,6 +2660,16 @@ def remove(self):
25332660 else :
25342661 apt_packages = apt_packages + EEVariables .ee_php
25352662
2663+ #PHP7.0 for debian(jessie+)
2664+ if self .app .pargs .php7 :
2665+ if (EEVariables .ee_platform_codename == 'jessie' ):
2666+ Log .debug (self , "Removing apt_packages variable of PHP 7.0" )
2667+ apt_packages = apt_packages + EEVariables .ee_php7_0
2668+ if not EEAptGet .is_installed (self , 'php5-fpm' ):
2669+ apt_packages = apt_packages + EEVariables .ee_php_extra
2670+ else :
2671+ Log .info (self ,"PHP 7.0 not supported." )
2672+
25362673 if self .app .pargs .php7 :
25372674 if (EEVariables .ee_platform_codename == 'trusty' or EEVariables .ee_platform_codename == 'xenial' ):
25382675 Log .debug (self , "Removing apt_packages variable of PHP 7.0" )
@@ -2615,6 +2752,7 @@ def remove(self):
26152752
26162753 Log .info (self , "Successfully removed packages" )
26172754
2755+ #Added for Ondrej Repo missing package Fix
26182756 if self .app .pargs .php7 :
26192757 if EEAptGet .is_installed (self , 'php5.6-fpm' ):
26202758 Log .info (self , "PHP5.6-fpm found on system." )
@@ -2704,6 +2842,17 @@ def purge(self):
27042842 apt_packages = apt_packages + EEVariables .ee_php_extra
27052843 else :
27062844 apt_packages = apt_packages + EEVariables .ee_php
2845+
2846+ #For debian --php7
2847+ if self .app .pargs .php7 :
2848+ if (EEVariables .ee_platform_codename == 'jessie' ):
2849+ Log .debug (self , "Removing apt_packages variable of PHP 7.0" )
2850+ apt_packages = apt_packages + EEVariables .ee_php7_0
2851+ if not EEAptGet .is_installed (self , 'php5-fpm' ):
2852+ apt_packages = apt_packages + EEVariables .ee_php_extra
2853+ else :
2854+ Log .info (self ,"PHP 7.0 not supported." )
2855+
27072856 if self .app .pargs .php7 :
27082857 if (EEVariables .ee_platform_codename == 'trusty' or EEVariables .ee_platform_codename == 'xenial' ):
27092858 Log .debug (self , "Removing apt_packages variable of PHP 7.0" )
@@ -2788,6 +2937,7 @@ def purge(self):
27882937
27892938 Log .info (self , "Successfully purged packages" )
27902939
2940+ #Added for php Ondrej repo missing package fix
27912941 if self .app .pargs .php7 :
27922942 if EEAptGet .is_installed (self , 'php5.6-fpm' ):
27932943 Log .info (self , "PHP5.6-fpm found on system." )
0 commit comments