Skip to content

Commit 84cbe2f

Browse files
Alexandros Ioannidesjaapmarcus
andauthored
Enhance/php fpm (hestiacp#2343)
* Create php-fpm.conf * Already in v-add-web-php * Add custom php-fpm.conf * Update current PHP-FPM installations * Rename 1.5.4 to 1.5.5 Co-authored-by: Jaap Marcus <9754650+jaapmarcus@users.noreply.github.com>
1 parent 3af4b57 commit 84cbe2f

File tree

6 files changed

+182
-19
lines changed

6 files changed

+182
-19
lines changed

bin/v-add-web-php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ v_tpl=${version//.}
119119
rm -f /etc/php/$version/fpm/pool.d/*
120120
cp -f $HESTIA_INSTALL_DIR/php-fpm/dummy.conf /etc/php/$version/fpm/pool.d/
121121
sed -i "s/9999/99$v_tpl/g" /etc/php/$version/fpm/pool.d/dummy.conf
122+
cp -f $HESTIA_INSTALL_DIR/php-fpm/php-fpm.conf /etc/php/$version/fpm/
123+
sed -i "s/fpm_v/$version/g" /etc/php/$version/fpm/php-fpm.conf
122124

123125
# Install backend template
124126
cp -f $HESTIA_INSTALL_DIR/php-fpm/multiphp.tpl \

install/deb/php-fpm/php-fpm.conf

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
;;;;;;;;;;;;;;;;;;;;;
2+
; FPM Configuration ;
3+
;;;;;;;;;;;;;;;;;;;;;
4+
5+
; All relative paths in this configuration file are relative to PHP's install
6+
; prefix (/usr). This prefix can be dynamically changed by using the
7+
; '-p' argument from the command line.
8+
9+
;;;;;;;;;;;;;;;;;;
10+
; Global Options ;
11+
;;;;;;;;;;;;;;;;;;
12+
13+
[global]
14+
; Pid file
15+
; Note: the default prefix is /var
16+
; Default Value: none
17+
; Warning: if you change the value here, you need to modify systemd
18+
; service PIDFile= setting to match the value here.
19+
pid = /run/php/phpfpm_v-fpm.pid
20+
21+
; Error log file
22+
; If it's set to "syslog", log is sent to syslogd instead of being written
23+
; into a local file.
24+
; Note: the default prefix is /var
25+
; Default Value: log/php-fpm.log
26+
error_log = /var/log/phpfpm_v-fpm.log
27+
28+
; syslog_facility is used to specify what type of program is logging the
29+
; message. This lets syslogd specify that messages from different facilities
30+
; will be handled differently.
31+
; See syslog(3) for possible values (ex daemon equiv LOG_DAEMON)
32+
; Default Value: daemon
33+
;syslog.facility = daemon
34+
35+
; syslog_ident is prepended to every message. If you have multiple FPM
36+
; instances running on the same server, you can change the default value
37+
; which must suit common needs.
38+
; Default Value: php-fpm
39+
;syslog.ident = php$fpm_v-fpm
40+
41+
; Log level
42+
; Possible Values: alert, error, warning, notice, debug
43+
; Default Value: notice
44+
log_level = error
45+
46+
; Log limit on number of characters in the single line (log entry). If the
47+
; line is over the limit, it is wrapped on multiple lines. The limit is for
48+
; all logged characters including message prefix and suffix if present. However
49+
; the new line character does not count into it as it is present only when
50+
; logging to a file descriptor. It means the new line character is not present
51+
; when logging to syslog.
52+
; Default Value: 1024
53+
;log_limit = 4096
54+
55+
; Log buffering specifies if the log line is buffered which means that the
56+
; line is written in a single write operation. If the value is false, then the
57+
; data is written directly into the file descriptor. It is an experimental
58+
; option that can potentially improve logging performance and memory usage
59+
; for some heavy logging scenarios. This option is ignored if logging to syslog
60+
; as it has to be always buffered.
61+
; Default value: yes
62+
;log_buffering = no
63+
64+
; If this number of child processes exit with SIGSEGV or SIGBUS within the time
65+
; interval set by emergency_restart_interval then FPM will restart. A value
66+
; of '0' means 'Off'.
67+
; Default Value: 0
68+
emergency_restart_threshold = 10
69+
70+
; Interval of time used by emergency_restart_interval to determine when
71+
; a graceful restart will be initiated. This can be useful to work around
72+
; accidental corruptions in an accelerator's shared memory.
73+
; Available Units: s(econds), m(inutes), h(ours), or d(ays)
74+
; Default Unit: seconds
75+
; Default Value: 0
76+
emergency_restart_interval = 60s
77+
78+
; Time limit for child processes to wait for a reaction on signals from master.
79+
; Available units: s(econds), m(inutes), h(ours), or d(ays)
80+
; Default Unit: seconds
81+
; Default Value: 0
82+
process_control_timeout = 10s
83+
84+
; The maximum number of processes FPM will fork. This has been designed to control
85+
; the global number of processes when using dynamic PM within a lot of pools.
86+
; Use it with caution.
87+
; Note: A value of 0 indicates no limit
88+
; Default Value: 0
89+
; process.max = 128
90+
91+
; Specify the nice(2) priority to apply to the master process (only if set)
92+
; The value can vary from -19 (highest priority) to 20 (lowest priority)
93+
; Note: - It will only work if the FPM master process is launched as root
94+
; - The pool process will inherit the master process priority
95+
; unless specified otherwise
96+
; Default Value: no set
97+
; process.priority = -19
98+
99+
; Send FPM to background. Set to 'no' to keep FPM in foreground for debugging.
100+
; Default Value: yes
101+
;daemonize = yes
102+
103+
; Set open file descriptor rlimit for the master process.
104+
; Default Value: system defined value
105+
;rlimit_files = 1024
106+
107+
; Set max core size rlimit for the master process.
108+
; Possible Values: 'unlimited' or an integer greater or equal to 0
109+
; Default Value: system defined value
110+
;rlimit_core = 0
111+
112+
; Specify the event mechanism FPM will use. The following is available:
113+
; - select (any POSIX os)
114+
; - poll (any POSIX os)
115+
; - epoll (linux >= 2.5.44)
116+
; - kqueue (FreeBSD >= 4.1, OpenBSD >= 2.9, NetBSD >= 2.0)
117+
; - /dev/poll (Solaris >= 7)
118+
; - port (Solaris >= 10)
119+
; Default Value: not set (auto detection)
120+
events.mechanism = epoll
121+
122+
; When FPM is built with systemd integration, specify the interval,
123+
; in seconds, between health report notification to systemd.
124+
; Set to 0 to disable.
125+
; Available Units: s(econds), m(inutes), h(ours)
126+
; Default Unit: seconds
127+
; Default value: 10
128+
;systemd_interval = 10
129+
130+
;;;;;;;;;;;;;;;;;;;;
131+
; Pool Definitions ;
132+
;;;;;;;;;;;;;;;;;;;;
133+
134+
; Multiple pools of child processes may be started with different listening
135+
; ports and different management options. The name of the pool will be
136+
; used in logs and stats. There is no limitation on the number of pools which
137+
; FPM can handle. Your system will tell you anyway :)
138+
139+
; Include one or more files. If glob(3) exists, it is used to include a bunch of
140+
; files from a glob(3) pattern. This directive can be used everywhere in the
141+
; file.
142+
; Relative path can also be used. They will be prefixed by:
143+
; - the global prefix if it's been set (-p argument)
144+
; - /usr otherwise
145+
include=/etc/php/fpm_v/fpm/pool.d/*.conf

install/hst-install-debian.sh

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ HESTIA_INSTALL_DIR="$HESTIA/install/deb"
3131
VERBOSE='no'
3232

3333
# Define software versions
34-
HESTIA_INSTALL_VER='1.5.4'
34+
HESTIA_INSTALL_VER='1.5.5~alpha'
3535
# Dependencies
3636
pma_v='5.1.1'
3737
rc_v="1.5.1"
@@ -1399,20 +1399,14 @@ fi
13991399

14001400
if [ "$multiphp" = 'yes' ] ; then
14011401
for v in "${multiphp_v[@]}"; do
1402-
rm -f /etc/php/$v/fpm/pool.d/*
1403-
echo "[ * ] Install PHP version $v..."
1402+
echo "[ * ] Install PHP $v..."
14041403
$HESTIA/bin/v-add-web-php "$v" > /dev/null 2>&1
14051404
done
14061405
fi
14071406

14081407
if [ "$phpfpm" = 'yes' ]; then
1409-
echo "[ * ] Configuring PHP-FPM..."
1408+
echo "[ * ] Configuring PHP $fpm_v..."
14101409
$HESTIA/bin/v-add-web-php "$fpm_v" > /dev/null 2>&1
1411-
cp -f $HESTIA_INSTALL_DIR/php-fpm/www.conf /etc/php/$fpm_v/fpm/pool.d/www.conf
1412-
update-rc.d php$fpm_v-fpm defaults > /dev/null 2>&1
1413-
systemctl start php$fpm_v-fpm >> $LOG
1414-
check_result $? "php-fpm start failed"
1415-
update-alternatives --set php /usr/bin/php$fpm_v > /dev/null 2>&1
14161410
fi
14171411

14181412

install/hst-install-ubuntu.sh

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ HESTIA_INSTALL_DIR="$HESTIA/install/deb"
3131
VERBOSE='no'
3232

3333
# Define software versions
34-
HESTIA_INSTALL_VER='1.5.4'
34+
HESTIA_INSTALL_VER='1.5.5~alpha'
3535
# Dependencies
3636
pma_v='5.1.1'
3737
rc_v="1.5.1"
@@ -1430,20 +1430,14 @@ fi
14301430

14311431
if [ "$multiphp" = 'yes' ] ; then
14321432
for v in "${multiphp_v[@]}"; do
1433-
rm -f /etc/php/$v/fpm/pool.d/*
1434-
echo "[ * ] Install PHP version $v..."
1433+
echo "[ * ] Install PHP $v..."
14351434
$HESTIA/bin/v-add-web-php "$v" > /dev/null 2>&1
14361435
done
14371436
fi
14381437

14391438
if [ "$phpfpm" = 'yes' ]; then
1440-
echo "[ * ] Configuring PHP-FPM..."
1439+
echo "[ * ] Configuring PHP $fpm_v..."
14411440
$HESTIA/bin/v-add-web-php "$fpm_v" > /dev/null 2>&1
1442-
cp -f $HESTIA_INSTALL_DIR/php-fpm/www.conf /etc/php/$fpm_v/fpm/pool.d/www.conf
1443-
update-rc.d php$fpm_v-fpm defaults > /dev/null 2>&1
1444-
systemctl start php$fpm_v-fpm >> $LOG
1445-
check_result $? "php-fpm start failed"
1446-
update-alternatives --set php /usr/bin/php$fpm_v > /dev/null 2>&1
14471441
fi
14481442

14491443

install/upgrade/versions/1.5.5.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
3+
# Hestia Control Panel upgrade script for target version 1.5.5
4+
5+
#######################################################################################
6+
####### Place additional commands below. #######
7+
#######################################################################################
8+
####### Pass through information to the end user in case of a issue or problem #######
9+
####### #######
10+
####### Use add_upgrade_message "My message here" to include a message #######
11+
####### in the upgrade notification email. Example: #######
12+
####### #######
13+
####### add_upgrade_message "My message here" #######
14+
####### #######
15+
####### You can use \n within the string to create new lines. #######
16+
#######################################################################################
17+
18+
upgrade_config_set_value 'UPGRADE_UPDATE_WEB_TEMPLATES' 'false'
19+
upgrade_config_set_value 'UPGRADE_UPDATE_DNS_TEMPLATES' 'false'
20+
upgrade_config_set_value 'UPGRADE_UPDATE_MAIL_TEMPLATES' 'false'
21+
upgrade_config_set_value 'UPGRADE_REBUILD_USERS' 'true'
22+
upgrade_config_set_value 'UPGRADE_UPDATE_FILEMANAGER_CONFIG' 'false'
23+
24+
# Update php-fpm.conf
25+
for version in /etc/php/*/fpm/php-fpm.conf; do
26+
cp -f $HESTIA_INSTALL_DIR/php-fpm/php-fpm.conf /etc/php/$version/fpm/
27+
sed -i "s/fpm_v/$version/g" /etc/php/$version/fpm/php-fpm.conf
28+
done

src/deb/hestia/control

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Source: hestia
22
Package: hestia
33
Priority: optional
4-
Version: 1.5.4
4+
Version: 1.5.5~alpha
55
Section: admin
66
Maintainer: HestiaCP <info@hestiacp.com>
77
Homepage: https://www.hestiacp.com

0 commit comments

Comments
 (0)