view modules/website/manifests/php.pp @ 257:675c1cc61eaf

Update Apache module to get CentOS 8 support Unfortunately it only fixes some bits. mod_wsgi still needs other approaches This also overrides the vhost modification to make them come last in the import order (after module loading)
author IBBoard <dev@ibboard.co.uk>
date Sun, 22 Dec 2019 14:43:29 -0500
parents c3fa3d65aa83
children 99e3ca448d55
line wrap: on
line source

class website::php(
    $suffix = '',
    $opcache = undef,
    $extras = [],
    ) {
  Package <| tag == 'php-package' |> -> File <| tag == 'php-file' |> ~> Service['httpd']

  if $suffix =~ /^7[1-9]w$/ {
    $php_core = "mod_php${suffix}"
  } else {
    $php_core = "php${suffix}"
  }

  $packages = [ $php_core, "php${suffix}-mbstring", "php${suffix}-xml", "php${suffix}-gd" ]
  package { $packages:
    ensure => installed,
    tag => 'php-package',
  }

  file { '/etc/php.d/custom-lockdown.ini':
    ensure => present,
    content => 'allow_url_fopen = \'off\'
    expose_php = Off',
    tag => 'php-file',
  }
  file { '/etc/php.d/custom-php.ini':
    ensure => present,
    source => 'puppet:///modules/website/custom-php.ini',
    tag => 'php-file',
  }

  if $opcache {
    package { "php${suffix}-${opcache}":
      ensure => installed,
      require => Package[$php_core],
      tag => 'php-package',
    }
    # Use Remi's (and the OS's) naming convention
    file { '/etc/php.d/opcache.ini':
      ensure => absent,
    }
    file { '/etc/php.d/10-opcache.ini':
      ensure => present,
      source => 'puppet:///modules/website/opcache.ini',
      tag => 'php-file',
    }
  }
}