forked from cfengine/contrib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
php_pecl_http_extension_is_installed_and_integrated.cf
61 lines (40 loc) · 1.76 KB
/
php_pecl_http_extension_is_installed_and_integrated.cf
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
# Install pecl_http PHP module to provide HttpRequest class to our PHP Web app:
# - run "pecl install pecl_http" and set SELinux type on http.so to textrel_shlib_t
# - edit /etc/php.ini to tell php to dynamically load http.so
#
# TODO: instead of using select_line_matching, use begin and end select region
# to insert the extension=http.so line into /etc/php.ini at the end of instead
# of in the middle of the Dynamic Extensions block so it looks cleaner.
#
# Author: Aleksey Tsalolikhin.
# Date: 14 Feb 2011.
body common control
{
inputs => {
"cfengine_stdlib.cf",
};
}
bundle agent php_pecl_http_extension_is_installed_and_integrated {
files:
"/etc/php.ini"
edit_line => tell_php_to_load_http_extension;
classes:
"pecl_http_module_exists" expression => fileexists("/usr/lib64/php/modules/http.so");
commands:
!pecl_http_module_exists::
"/usr/bin/yes ' ' | /usr/bin/pecl install pecl_http && /usr/bin/chcon -t textrel_shlib_t /usr/lib64/php/modules/http.so" # force the install to be non-interactive - let the pecl install pecl_http use the default settings. Then set SELinux label.
contain => in_shell; # so we can do a pipeline
}
bundle edit_line tell_php_to_load_http_extension {
vars:
"dynamically_load_http_module" string => "extension=http.so ; Theater Viewer Map requires HttpRequest which is provided by pecl_http"; # this is the text we want in /etc/php.ini
insert_lines:
"$(dynamically_load_http_module)"
location => in_Dynamic_Extensions_section;
}
body location in_Dynamic_Extensions_section
{
before_after => "after";
first_last => "first";
select_line_matching => "; Dynamic Extensions ;";
}