Mercurial > repos > other > Puppet
annotate modules/website/manifests/php.pp @ 419:0c627ff3a7c3
Fix PHP setup on CentOS
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sat, 08 Oct 2022 15:53:01 +0100 |
parents | 76d18a918e7f |
children | 8421eb25c329 |
rev | line source |
---|---|
0
956e484adc12
Initial public release of Puppet configs
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
1 class website::php( |
956e484adc12
Initial public release of Puppet configs
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
2 $suffix = '', |
320 | 3 $module = undef, |
69
565b788f7ac1
Allow for specifying extra PHP packages (e.g. to enable Posix)
IBBoard <dev@ibboard.co.uk>
parents:
17
diff
changeset
|
4 $extras = [], |
0
956e484adc12
Initial public release of Puppet configs
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
5 ) { |
402 | 6 include ::apache::params |
390
df5ad1612af7
Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents:
357
diff
changeset
|
7 if $osfamily == 'RedHat' { |
df5ad1612af7
Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents:
357
diff
changeset
|
8 # Work around SELinux "denied execmem" warnings from preg_match JITing |
df5ad1612af7
Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents:
357
diff
changeset
|
9 $pcre_jit = 0 |
df5ad1612af7
Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents:
357
diff
changeset
|
10 } |
df5ad1612af7
Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents:
357
diff
changeset
|
11 else { |
df5ad1612af7
Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents:
357
diff
changeset
|
12 $pcre_jit = 1 |
df5ad1612af7
Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents:
357
diff
changeset
|
13 } |
419 | 14 |
15 file { '/run/php/': | |
16 ensure => directory, | |
17 } -> | |
390
df5ad1612af7
Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents:
357
diff
changeset
|
18 class { '::php': |
df5ad1612af7
Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents:
357
diff
changeset
|
19 ensure => present, |
df5ad1612af7
Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents:
357
diff
changeset
|
20 manage_repos => false, |
df5ad1612af7
Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents:
357
diff
changeset
|
21 fpm => true, |
419 | 22 fpm_service_enable => true, |
23 fpm_service_ensure => 'running', | |
390
df5ad1612af7
Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents:
357
diff
changeset
|
24 fpm_pools => { |
df5ad1612af7
Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents:
357
diff
changeset
|
25 'www' => { |
400
f354100b688a
Switch to Ubuntu-standard PHP FPM socket dir
IBBoard <dev@ibboard.co.uk>
parents:
399
diff
changeset
|
26 'listen' => '/run/php/php-fpm.sock', |
402 | 27 'listen_owner' => $::apache::params::user, |
28 'listen_group' => $::apache::params::group, | |
390
df5ad1612af7
Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents:
357
diff
changeset
|
29 'slowlog' => '/var/log/php-fpm/www-slow.log', |
df5ad1612af7
Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents:
357
diff
changeset
|
30 'security_limit_extensions' => ['.php', '.html'], |
df5ad1612af7
Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents:
357
diff
changeset
|
31 'php_admin_value' => { |
df5ad1612af7
Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents:
357
diff
changeset
|
32 'memory_limit' => '256M', |
df5ad1612af7
Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents:
357
diff
changeset
|
33 }, |
df5ad1612af7
Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents:
357
diff
changeset
|
34 'php_value' => { |
df5ad1612af7
Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents:
357
diff
changeset
|
35 # 'session.save_path' => '/var/lib/php/session' # Ubuntu uses plural, CentOS uses singular |
df5ad1612af7
Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents:
357
diff
changeset
|
36 }, |
df5ad1612af7
Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents:
357
diff
changeset
|
37 }, |
df5ad1612af7
Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents:
357
diff
changeset
|
38 }, |
df5ad1612af7
Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents:
357
diff
changeset
|
39 dev => false, |
df5ad1612af7
Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents:
357
diff
changeset
|
40 composer => false, |
df5ad1612af7
Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents:
357
diff
changeset
|
41 pear => false, |
df5ad1612af7
Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents:
357
diff
changeset
|
42 settings => { |
df5ad1612af7
Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents:
357
diff
changeset
|
43 'PHP/default_charset' => 'UTF-8', |
df5ad1612af7
Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents:
357
diff
changeset
|
44 'PHP/pcre.jit' => $pcre_jit, |
df5ad1612af7
Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents:
357
diff
changeset
|
45 # Space isn't scarce these days - increase default sizes |
df5ad1612af7
Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents:
357
diff
changeset
|
46 'PHP/upload_max_filesize' => "8M", |
df5ad1612af7
Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents:
357
diff
changeset
|
47 'PHP/post_max_size' => "8M", |
df5ad1612af7
Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents:
357
diff
changeset
|
48 'Data/date.timezone' => 'UTC', |
df5ad1612af7
Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents:
357
diff
changeset
|
49 }, |
df5ad1612af7
Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents:
357
diff
changeset
|
50 extensions => { |
df5ad1612af7
Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents:
357
diff
changeset
|
51 gd => {}, |
df5ad1612af7
Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents:
357
diff
changeset
|
52 mbstring => {}, |
df5ad1612af7
Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents:
357
diff
changeset
|
53 opcache => { |
df5ad1612af7
Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents:
357
diff
changeset
|
54 settings => { |
df5ad1612af7
Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents:
357
diff
changeset
|
55 'zend_extension' => 'opcache.so', |
df5ad1612af7
Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents:
357
diff
changeset
|
56 'opcache.enable' => 1, |
df5ad1612af7
Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents:
357
diff
changeset
|
57 'opcache.enable_cli' => 1, |
df5ad1612af7
Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents:
357
diff
changeset
|
58 'opcache.interned_strings_buffer' => 8, |
df5ad1612af7
Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents:
357
diff
changeset
|
59 'opcache.max_accelerated_files' => 10000, |
df5ad1612af7
Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents:
357
diff
changeset
|
60 'opcache.memory_consumption' => 128, |
df5ad1612af7
Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents:
357
diff
changeset
|
61 'opcache.save_comments' => 1, |
df5ad1612af7
Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents:
357
diff
changeset
|
62 'opcache.revalidate_freq' => 1, |
df5ad1612af7
Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents:
357
diff
changeset
|
63 } |
df5ad1612af7
Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents:
357
diff
changeset
|
64 }, |
df5ad1612af7
Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents:
357
diff
changeset
|
65 xml => {}, |
399
2c6065b5be5e
Switch to config-based PHP extensions
IBBoard <dev@ibboard.co.uk>
parents:
390
diff
changeset
|
66 } + $extras, |
390
df5ad1612af7
Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents:
357
diff
changeset
|
67 } |
df5ad1612af7
Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents:
357
diff
changeset
|
68 apache::custom_config { "php.conf": |
df5ad1612af7
Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents:
357
diff
changeset
|
69 ensure => present, |
df5ad1612af7
Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents:
357
diff
changeset
|
70 source => "puppet:///modules/website/php.conf" |
df5ad1612af7
Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents:
357
diff
changeset
|
71 } |
df5ad1612af7
Adapt configs to support Ubuntu
IBBoard <dev@ibboard.co.uk>
parents:
357
diff
changeset
|
72 class { ['apache::mod::proxy', 'apache::mod::proxy_fcgi']:} |
0
956e484adc12
Initial public release of Puppet configs
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
73 } |