forked from voxpupuli/puppet-php
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
340 lines (259 loc) · 11.8 KB
/
index.html
File metadata and controls
340 lines (259 loc) · 11.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
File: README
— Documentation by YARD 0.9.9
</title>
<link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
<link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
<script type="text/javascript" charset="utf-8">
pathId = "";
relpath = '';
</script>
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
</head>
<body>
<div class="nav_wrap">
<iframe id="nav" src="puppet_class_list.html?1"></iframe>
<div id="resizer"></div>
</div>
<div id="main" tabindex="-1">
<div id="header">
<div id="menu">
<a href="_index.html">Index</a> »
<span class="title">File: README</span>
</div>
<div id="search">
<a class="full_list_link" id="puppet_class_list_link"
href="puppet_class_list.html">
<svg width="24" height="24">
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
</svg>
</a>
</div>
<div class="clear"></div>
</div>
<div id="content"><div id='filecontents'><p><a href="https://forge.puppetlabs.com/puppet/php"><img src="http://img.shields.io/puppetforge/v/puppet/php.svg" alt="Puppet Forge"></a>
<a href="https://travis-ci.org/voxpupuli/puppet-php"><img src="https://travis-ci.org/voxpupuli/puppet-php.svg?branch=master" alt="Build Status"></a></p>
<h2>Current Status</h2>
<p>As the original creators of <code>puppet-php</code> are no longer maintaining the module, it has been handed over into the care of Vox Pupuli.
Please be sure to update all your links to the new location.</p>
<h1>voxpupuli/php Puppet Module</h1>
<p>voxpupuli/php is a Puppet module for managing PHP with a strong focus
on php-fpm. The module aims to use sane defaults for the supported
architectures. We strive to support all recent versions of Debian,
Ubuntu, RedHat/CentOS, openSUSE/SLES and FreeBSD. Managing Apache
with <code>mod_php</code> is not supported.</p>
<p>This originally was a fork of <a href="https://github.com/jippi/puppet-php">jippi/puppet-php</a>
(nodes-php on Puppet Forge) but has since been rewritten in large parts.</p>
<h2>Usage</h2>
<p>Quickest way to get started is simply <code>include</code>'ing the <em><code>php</code> class</em>.</p>
<pre class="code puppet"><code class="puppet">include '::php'
</code></pre>
<p>Or, you can override defaults and specify additional custom
configurations by declaring <code>class { '::php': }</code> with parameters:</p>
<pre class="code puppet"><code class="puppet">class { '::php':
ensure => latest,
manage_repos => true,
fpm => true,
dev => true,
composer => true,
pear => true,
phpunit => false,
}
</code></pre>
<p>Optionally the PHP version or configuration root directory can be changed also:</p>
<pre class="code puppet"><code class="puppet">class { '::php::globals':
php_version => '7.0',
config_root => '/etc/php/7.0',
}->
class { '::php':
manage_repos => true
}
</code></pre>
<p>There are more configuration options available. Please refer to the
auto-generated documentation at <a href="http://php.puppet.mayflower.de/">http://php.puppet.mayflower.de/</a>.</p>
<h3>Defining <code>php.ini</code> settings</h3>
<p>PHP configuration parameters in <code>php.ini</code> files can be defined as parameter
<code>settings</code> on the main <code>php</code> class, or <code>php::fpm</code> / <code>php::cli</code> classes,
or <code>php::extension</code> resources for each component independently.</p>
<p>These settings are written into their respective <code>php.ini</code> file. Global
settings in <code>php::settings</code> are merged with the settings of all components.
Please note that settings of extensions are always independent.</p>
<p>In the following example the PHP options and timezone will be set in
all PHP configurations, i.e. the PHP cli application and all php-fpm pools.</p>
<pre class="code puppet"><code class="puppet"> class { '::php':
settings => {
'PHP/max_execution_time' => '90',
'PHP/max_input_time' => '300',
'PHP/memory_limit' => '64M',
'PHP/post_max_size' => '32M',
'PHP/upload_max_filesize' => '32M',
'Date/date.timezone' => 'Europe/Berlin',
},
}
</code></pre>
<h3>Installing extensions</h3>
<p>PHP configuration parameters in <code>php.ini</code> files can be defined
as parameter <code>extensions</code> on the main <code>php</code> class. They are
activated for all activated SAPIs.</p>
<pre class="code puppet"><code class="puppet"> class { '::php':
extensions => {
bcmath => { },
imagick => {
provider => pecl,
},
xmlrpc => { },
memcached => {
provider => 'pecl',
header_packages => [ 'libmemcached-devel', ],
},
apc => {
provider => 'pecl',
settings => {
'apc/stat' => '1',
'apc/stat_ctime' => '1',
},
sapi => 'fpm',
},
},
}
</code></pre>
<p>See <a href="http://php.puppet.mayflower.de/php/extension.html">the documentation</a>
of the <code>php::extension</code> resource for all available parameters and default
values.</p>
<h3>Defining php-fpm pools</h3>
<p>If different php-fpm pools are required, you can use <code>php::fpm::pool</code>
defined resource type. A single pool called <code>www</code> will be configured
by default. Specify additional pools like so:</p>
<pre class="code puppet"><code class="puppet"> php::fpm::pool { 'www2':
listen => '127.0.1.1:9000',
}
</code></pre>
<p>For an overview of all possible parameters for <code>php::fpm::pool</code> resources
please see <a href="http://php.puppet.mayflower.de/php/fpm/pool.html">its documention</a>.</p>
<h3>Overriding php-fpm user</h3>
<p>By default, php-fpm is set up to run as Apache. If you need to customize that user, you can do that like so:</p>
<pre class="code puppet"><code class="puppet"> class { '::php':
fpm_user => 'nginx',
fpm_group => 'nginx',
}
</code></pre>
<h3>Alternative examples using Hiera</h3>
<p>Alternative to the Puppet DSL code examples above, you may optionally define your PHP configuration using Hiera.</p>
<p>Below are all the examples you see above, but defined in YAML format for use with Hiera.</p>
<pre class="code yaml"><code class="yaml">---
php::ensure: latest
php::manage_repos: true
php::fpm: true
php::fpm_user: 'nginx'
php::fpm_group: 'nginx'
php::dev: true
php::composer: true
php::pear: true
php::phpunit: false
php::settings:
'PHP/max_execution_time': '90'
'PHP/max_input_time': '300'
'PHP/memory_limit': '64M'
'PHP/post_max_size': '32M'
'PHP/upload_max_filesize': '32M'
'Date/date.timezone': 'Europe/Berlin'
php::extensions:
bcmath: {}
xmlrpc: {}
imagick:
provider: pecl
memcached:
provider: pecl
header_packages:
- libmemcached-dev
apc:
provider: pecl
settings:
'apc/stat': 1
'apc/stat_ctime': 1
sapi: 'fpm'
php::fpm::pools:
www2:
listen: '127.0.1.1:9000'
</code></pre>
<h2>Notes</h2>
<h3>Debian squeeze & Ubuntu precise come with PHP 5.3</h3>
<p>On Debian-based systems, we use <code>php5enmod</code> to enable extension-specific
configuration. This script is only present in <code>php5</code> packages beginning with
version 5.4. Furthermore, PHP 5.3 is not supported by upstream anymore.</p>
<p>We strongly suggest you use a recent PHP version, even if you're using an
older though still supported distribution release. Our default is to have
<code>php::manage_repos</code> enabled to add apt sources for
<a href="http://www.dotdeb.org/">Dotdeb</a> on Debian and
<a href="https://launchpad.net/%7Eondrej/+archive/ubuntu/php5/">ppa:ondrej/php5</a> on
Ubuntu with packages for the current stable PHP version closely tracking
upstream.</p>
<h3>Ubuntu systems and Ondřej's PPA</h3>
<p>The older Ubuntu PPAs run by Ondřej have been deprecated (ondrej/php5, ondrej/php5.6)
in favor of a new PPA: ondrej/php which contains all 3 versions of PHP: 5.5, 5.6, and 7.0
Here's an example in hiera of getting PHP 5.6 installed with php-fpm, pear/pecl, and composer:</p>
<pre class="code ruby"><code class="ruby">php::globals::php_version: '5.6'
php::fpm: true
php::dev: true
php::composer: true
php::pear: true
php::phpunit: false
</code></pre>
<p>If you do not specify a php version, in Ubuntu the default will be 7.0 if you are
running Xenial (16.04), otherwise PHP 5.6 will be installed (for other versions)</p>
<h3>Apache support</h3>
<p>Apache with <code>mod_php</code> is not supported by this module. Please use
<a href="https://forge.puppetlabs.com/puppetlabs/apache">puppetlabs/apache</a> instead.</p>
<p>We prefer using php-fpm. You can find an example Apache vhost in
<code>manifests/apache_vhost.pp</code> that shows you how to use <code>mod_proxy_fcgi</code> to
connect to php-fpm.</p>
<h3>Facts</h3>
<p>We deliver a <code>phpversion</code> fact with this module. This is explicitly <strong>NOT</strong> intended
to be used within your puppet manifests as it will only work on your second puppet
run. Its intention is to make querying PHP versions per server easy via PuppetDB or Foreman.</p>
<h3>FreeBSD support</h3>
<p>On FreeBSD systems we purge the system-wide <code>extensions.ini</code> in favour of
per-module configuration files.</p>
<p>Please also note that support for Composer and PHPUnit on FreeBSD is untested
and thus likely incomplete.</p>
<h3>Running the test suite</h3>
<p>To run the tests install the ruby dependencies with <code>bundler</code> and execute
<code>rake</code>:</p>
<pre class="code ruby"><code class="ruby">bundle install --path vendor/bundle
bundle exec rake
</code></pre>
<h2>Bugs & New Features</h2>
<p>If you happen to stumble upon a bug, please feel free to create a pull request
with a fix (optionally with a test), and a description of the bug and how it
was resolved.</p>
<p>Or if you're not into coding, simply create an issue adding steps to let us
reproduce the bug and we will happily fix it.</p>
<p>If you have a good idea for a feature or how to improve this module in general,
please create an issue to discuss it. We are very open to feedback. Pull
requests are always welcome.</p>
<p>We hate orphaned and unmaintained Puppet modules as much as you do and
therefore promise that we will continue to maintain this module and keep
response times to issues short. If we happen to lose interest, we will write
a big fat warning into this README to let you know.</p>
<h2>License</h2>
<p>The project is released under the permissive MIT license.</p>
<p>The source can be found at
<a href="https://github.com/voxpupuli/puppet-php/">github.com/voxpupuli/puppet-php</a>.</p>
<p>This Puppet module was originally maintained by some fellow puppeteers at
<a href="https://mayflower.de">Mayflower GmbH</a> and is now maintained by
<a href="https://voxpupuli.org/">Vox Pupuli</a>.</p>
</div></div>
<div id="footer">
Generated by <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>.
</div>
</div>
</body>
</html>