changeset 454:d0e7979c7e8c

Update PHP configs for Ubuntu Mostly fixing some INI naming so that it is consistent between packages and what we write (so we don't end up with mixed/duplicate content)
author IBBoard <dev@ibboard.co.uk>
date Sun, 13 Aug 2023 15:26:37 +0100
parents dc725b618258
children a32771c91043
files manifests/templates.pp modules/website/manifests/php.pp
diffstat 2 files changed, 58 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/manifests/templates.pp	Sun Aug 13 15:25:01 2023 +0100
+++ b/manifests/templates.pp	Sun Aug 13 15:26:37 2023 +0100
@@ -476,6 +476,9 @@
 
 	if $operatingsystem == 'CentOS' {
 		$php_suffix = ''
+		$ini_prefix_20 = '20-'
+		$ini_prefix_30 = '30-'
+		$ini_prefix_40 = '40-'
 		$variant_prefix = 'php-'
 		$extra_prefix = 'pecl-'
 		$extra_extras = {
@@ -539,6 +542,9 @@
 	}
 	elsif $operatingsystem == 'Ubuntu' {
 		$php_suffix = ''
+		$ini_prefix_20 = ''
+		$ini_prefix_30 = ''
+		$ini_prefix_40 = ''
 		$variant_prefix = 'php-'
 		$extra_prefix = ''
 		# Work around constant re-install by enabling virtual packages
@@ -546,7 +552,17 @@
 		Package {
 			allow_virtual => true
 		}
-		$extra_extras = {}
+		$extra_extras = {
+			'xdebug' => {
+				# Occasional profiling retained in case I want to dig into
+				# Wordpress page load inefficiencies any more
+				ensure => absent,
+#				settings => {
+#					"xdebug.mode" => "profile",
+#					"xdebug.start_with_request" => "trigger",
+#				}
+			}
+		}
 	}
 
 	#Configure the PHP version to use
@@ -555,66 +571,66 @@
 		module => ($operatingsystem == 'CentOS' and versioncmp($operatingsystemrelease, '8') >= 0) ? { true => 'remi-7.4', default => undef },
 		extras => {
 			'bcmath' => {
-			        ini_prefix => '20-',
+			        ini_prefix => $ini_prefix_20,
 			},
 			'curl' => {
-			        ini_prefix => '20-',
+			        ini_prefix => $ini_prefix_20,
 			},
 			'dom' => {
-			        ini_prefix => '20-',
+			        ini_prefix => $ini_prefix_20,
 			},
 			'enchant' => {
-			        ini_prefix => '20-',
+			        ini_prefix => $ini_prefix_20,
 			},
 			'exif' => {
-			        ini_prefix => '20-',
+			        ini_prefix => $ini_prefix_20,
 			},
 			'fileinfo' => {
-			        ini_prefix => '20-',
+			        ini_prefix => $ini_prefix_20,
 			},
 			'gmp' => {
-			        ini_prefix => '20-',
+			        ini_prefix => $ini_prefix_20,
 			},
 			'intl' => {
-			        ini_prefix => '20-',
+			        ini_prefix => $ini_prefix_20,
 			},
 			'mysqlnd' => {
-				ini_prefix => '20-',
+				ini_prefix => $ini_prefix_20,
 			},
 			'pdo' => {
-				ini_prefix => '20-',
+				ini_prefix => $ini_prefix_20,
 			},
 			'simplexml' => {
-			        ini_prefix => '20-',
+			        ini_prefix => $ini_prefix_20,
 			},
 			'soap' => {
-			        ini_prefix => '20-',
+			        ini_prefix => $ini_prefix_20,
 			},
 			'xmlwriter' => {
-			        ini_prefix => '20-',
+			        ini_prefix => $ini_prefix_20,
 			},
 			'mysqli' => {
-				ini_prefix => '30-',
+				ini_prefix => $ini_prefix_30,
 			},
 			'pdo_mysql' => {
-				ini_prefix => '30-',
+				ini_prefix => $ini_prefix_30,
 				# Provided by the php-mysql package in CentOS and declared with "Provides"
 				# And Ubuntu is the same but without the "Provides"
 				provider => "none",
 			},
 			'xmlreader' => {
-				ini_prefix => '30-',
+				ini_prefix => $ini_prefix_30,
 			},
 			'zip' => {
-			        ini_prefix => '30-',
+			        ini_prefix => $ini_prefix_30,
 				package_prefix => "${variant_prefix}${extra_prefix}"
 			},
 			'apcu' => {
-			        ini_prefix => '40-',
+			        ini_prefix => $ini_prefix_40,
 				package_prefix => "${variant_prefix}${extra_prefix}"
 			},
 			'imagick' => {
-			        ini_prefix => '40-',
+			        ini_prefix => $ini_prefix_40,
 				package_prefix => "${variant_prefix}${extra_prefix}"
 			},
 		} + $extra_extras,
--- a/modules/website/manifests/php.pp	Sun Aug 13 15:25:01 2023 +0100
+++ b/modules/website/manifests/php.pp	Sun Aug 13 15:26:37 2023 +0100
@@ -12,6 +12,17 @@
     $pcre_jit = 1
   }
 
+  if $operatingsystem == 'CentOS' {
+    $ini_prefix_10 = '10-'
+    $ini_prefix_20 = '20-'
+  }
+  elsif $operatingsystem == 'Ubuntu' {
+    # Ubuntu doesn't prefix its ini files as created here
+    # and has a different way of handling ordering
+    $ini_prefix_10 = ''
+    $ini_prefix_20 = ''
+  }
+
   file { '/run/php/':
     ensure => directory,
   } ->
@@ -52,33 +63,35 @@
     },
     extensions => {
       ctype => {
-        ini_prefix => '20-',
+        ini_prefix => $ini_prefix_20,
       },
       gd => {
-        ini_prefix => '20-',
+        ini_prefix => $ini_prefix_20,
       },
       iconv => {
-        ini_prefix => '20-',
+        ini_prefix => $ini_prefix_20,
       },
       mbstring => {
-        ini_prefix => '20-',
+        ini_prefix => $ini_prefix_20,
       },
       opcache => {
         ensure => present,
-        ini_prefix => '10-',
+        ini_prefix => $ini_prefix_10,
         zend => true,
         settings => {
           'opcache.enable' => 1,
           'opcache.enable_cli' => 1,
-          'opcache.interned_strings_buffer' => 16,
-          'opcache.max_accelerated_files' => 10000,
-          'opcache.memory_consumption' => 128,
+          'opcache.interned_strings_buffer' => 32,
+          'opcache.max_accelerated_files' => 15000,
+          'opcache.max_wasted_percentage' => 3,
+          'opcache.memory_consumption' => 256,
           'opcache.save_comments' => 1,
           'opcache.revalidate_freq' => 60,
+          'opcache.huge_code_pages' => 0,
         }
       },
       xml => {
-        ini_prefix => '20-',
+        ini_prefix => $ini_prefix_20,
       },
     } + $extras,
   }