-
Notifications
You must be signed in to change notification settings - Fork 1
/
README
executable file
·83 lines (64 loc) · 2.71 KB
/
README
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
php
Install PHP packages and configure PHP INI files, for using PHP from the CLI,
the Apache httpd module or FastCGI.
The module is very Red Hat Enterprise Linux focused, as the defaults try to
change everything in ways which are typical for RHEL, but should also work on
other distributions and might be possible to port if needed.
* `php::cli` : Simple class to install PHP's Command Line Interface
* `php::fpm::daemon` : Simple class to install PHP's FastCGI Process Manager
* `php::fpm::conf` : PHP FPM pool configuration definition
* `php::ini` : Definition to create php.ini files
* `php::mod_php5` : Simple class to install PHP's Apache httpd module
* `php::module` : Definition to manage separately packaged PHP modules
* `php::module::ini` : Definition to manage the ini files of separate modules
# Sample Usage
Create php.ini files for different uses, but based on the same template :
php::ini { '/etc/php.ini':
display_errors => 'On',
memory_limit => '256M',
}
php::ini { '/etc/httpd/conf/php.ini':
mail_add_x_header => 'Off',
# For the parent directory
require => Package['httpd'],
}
Install the PHP command line interface :
include php::cli
Install the PHP Apache httpd module, using its own php configuration file
(you will need mod_env in apache for this to work) :
class { 'php::mod_php5': inifile => '/etc/httpd/conf/php.ini' }
Install PHP modules which don't have any configuration :
php::module { [ 'ldap', 'mcrypt' ]: }
Configure PHP modules, which must be installed with php::module first :
php::module { [ 'pecl-apc', 'xml' ]: }
php::module::ini { 'pecl-apc':
settings => {
'apc.enabled' => '1',
'apc.shm_segments' => '1',
'apc.shm_size' => '64',
}
}
php::module::ini { 'xmlreader': pkgname => 'xml' }
php::module::ini { 'xmlwriter': ensure => absent }
Install PHP FastCGI Process Manager with a single pool to be used with nginx.
Note that we reuse the 'www' name to overwrite the example configuration :
include php::fpm::daemon
php::fpm::conf { 'www':
listen => '127.0.0.1:9001',
user => 'nginx',
# For the user to exist
require => Package['nginx'],
}
Then from the nginx configuration :
# PHP FastCGI backend
upstream wwwbackend {
server 127.0.0.1:9001;
}
# Proxy PHP requests to the FastCGI backend
location ~ \.php$ {
# Don't bother PHP if the file doesn't exist, return the built in
# 404 page (this also avoids "No input file specified" error pages)
if (!-f $request_filename) { return 404; }
include /etc/nginx/fastcgi.conf;
fastcgi_pass wwwbackend;
}