Skip to content

Commit 1d43a44

Browse files
authored
Add support for PHP v8.0 (hestiacp#1441)
1 parent a1ea7fd commit 1d43a44

File tree

22 files changed

+422
-4
lines changed

22 files changed

+422
-4
lines changed

bin/v-add-web-php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# options: VERSION
44
# labels: hestia
55
#
6-
# example: v-add-web-php 7.4
6+
# example: v-add-web-php 8.0
77
#
88
# The function checks and delete a fpm php version if not used by any domain.
99

@@ -32,7 +32,7 @@ php_fpm="/etc/init.d/php$version-fpm"
3232
# Verify php version format
3333
if [[ ! $version =~ ^[0-9]\.[0-9]+ ]]; then
3434
echo "The specified PHP version format is invalid, it should look like [0-9].[0-9]."
35-
echo "Example: 7.0, 7.4"
35+
echo "Example: 7.0, 7.4, 8.0"
3636
exit
3737
fi
3838

@@ -67,6 +67,11 @@ if [[ `echo "$version 7.2" | awk '{print ($1 < $2)}'` == 1 ]]; then
6767
mph="$mph php$version-mcrypt"
6868
fi
6969

70+
# Check if version is 8.0 or higher and drop php json.
71+
if [[ ${version:0:1} == "8" ]]; then
72+
mph=$(echo "$mph" | sed -e "s/php$version-json//")
73+
fi
74+
7075
if ! echo "$DB_SYSTEM" | grep -w 'mysql' >/dev/null; then
7176
mph=$(echo "$mph" | sed -e "s/php$version-mysql//")
7277
fi

install/deb/multiphp/apache2/PHP-56.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ pool_file_71="/etc/php/7.1/fpm/pool.d/$2.conf"
4545
pool_file_72="/etc/php/7.2/fpm/pool.d/$2.conf"
4646
pool_file_73="/etc/php/7.3/fpm/pool.d/$2.conf"
4747
pool_file_74="/etc/php/7.4/fpm/pool.d/$2.conf"
48+
pool_file_80="/etc/php/8.0/fpm/pool.d/$2.conf"
4849

4950
if [ ! -f "$pool_file_56" ]; then
5051
echo "$pool_conf" > $pool_file_56
@@ -76,4 +77,9 @@ if [ -f "$pool_file_74" ]; then
7677
service php7.4-fpm restart
7778
fi
7879

80+
if [ -f "$pool_file_80" ]; then
81+
rm $pool_file_80
82+
service php8.0-fpm restart
83+
fi
84+
7985
exit 0

install/deb/multiphp/apache2/PHP-70.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ pool_file_71="/etc/php/7.1/fpm/pool.d/$2.conf"
4545
pool_file_72="/etc/php/7.2/fpm/pool.d/$2.conf"
4646
pool_file_73="/etc/php/7.3/fpm/pool.d/$2.conf"
4747
pool_file_74="/etc/php/7.4/fpm/pool.d/$2.conf"
48+
pool_file_80="/etc/php/8.0/fpm/pool.d/$2.conf"
4849

4950
if [ -f "$pool_file_56" ]; then
5051
rm $pool_file_56
@@ -76,4 +77,9 @@ if [ -f "$pool_file_74" ]; then
7677
service php7.4-fpm restart
7778
fi
7879

80+
if [ -f "$pool_file_80" ]; then
81+
rm $pool_file_80
82+
service php8.0-fpm restart
83+
fi
84+
7985
exit 0

install/deb/multiphp/apache2/PHP-71.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ pool_file_71="/etc/php/7.1/fpm/pool.d/$2.conf"
4545
pool_file_72="/etc/php/7.2/fpm/pool.d/$2.conf"
4646
pool_file_73="/etc/php/7.3/fpm/pool.d/$2.conf"
4747
pool_file_74="/etc/php/7.4/fpm/pool.d/$2.conf"
48+
pool_file_80="/etc/php/8.0/fpm/pool.d/$2.conf"
4849

4950
if [ -f "$pool_file_56" ]; then
5051
rm $pool_file_56
@@ -76,4 +77,9 @@ if [ -f "$pool_file_74" ]; then
7677
service php7.4-fpm restart
7778
fi
7879

80+
if [ -f "$pool_file_80" ]; then
81+
rm $pool_file_80
82+
service php8.0-fpm restart
83+
fi
84+
7985
exit 0

install/deb/multiphp/apache2/PHP-72.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ pool_file_71="/etc/php/7.1/fpm/pool.d/$2.conf"
4545
pool_file_72="/etc/php/7.2/fpm/pool.d/$2.conf"
4646
pool_file_73="/etc/php/7.3/fpm/pool.d/$2.conf"
4747
pool_file_74="/etc/php/7.4/fpm/pool.d/$2.conf"
48+
pool_file_80="/etc/php/8.0/fpm/pool.d/$2.conf"
4849

4950
if [ -f "$pool_file_56" ]; then
5051
rm $pool_file_56
@@ -76,4 +77,9 @@ if [ -f "$pool_file_74" ]; then
7677
service php7.4-fpm restart
7778
fi
7879

80+
if [ -f "$pool_file_80" ]; then
81+
rm $pool_file_80
82+
service php8.0-fpm restart
83+
fi
84+
7985
exit 0

install/deb/multiphp/apache2/PHP-73.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ pool_file_71="/etc/php/7.1/fpm/pool.d/$2.conf"
4545
pool_file_72="/etc/php/7.2/fpm/pool.d/$2.conf"
4646
pool_file_73="/etc/php/7.3/fpm/pool.d/$2.conf"
4747
pool_file_74="/etc/php/7.4/fpm/pool.d/$2.conf"
48+
pool_file_80="/etc/php/8.0/fpm/pool.d/$2.conf"
4849

4950
if [ -f "$pool_file_56" ]; then
5051
rm $pool_file_56
@@ -76,4 +77,9 @@ if [ -f "$pool_file_74" ]; then
7677
service php7.4-fpm restart
7778
fi
7879

80+
if [ -f "$pool_file_80" ]; then
81+
rm $pool_file_80
82+
service php8.0-fpm restart
83+
fi
84+
7985
exit 0

install/deb/multiphp/apache2/PHP-74.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ pool_file_71="/etc/php/7.1/fpm/pool.d/$2.conf"
4545
pool_file_72="/etc/php/7.2/fpm/pool.d/$2.conf"
4646
pool_file_73="/etc/php/7.3/fpm/pool.d/$2.conf"
4747
pool_file_74="/etc/php/7.4/fpm/pool.d/$2.conf"
48+
pool_file_80="/etc/php/8.0/fpm/pool.d/$2.conf"
4849

4950
if [ -f "$pool_file_56" ]; then
5051
rm $pool_file_56
@@ -76,4 +77,9 @@ if [ ! -f "$pool_file_74" ]; then
7677
service php7.4-fpm restart
7778
fi
7879

80+
if [ -f "$pool_file_80" ]; then
81+
rm $pool_file_80
82+
service php8.0-fpm restart
83+
fi
84+
7985
exit 0
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
#!/bin/bash
2+
# Adding php pool conf
3+
user="$1"
4+
domain="$2"
5+
ip="$3"
6+
home_dir="$4"
7+
docroot="$5"
8+
9+
pool_conf="[$2]
10+
11+
listen = /run/php/php8.0-fpm-$2.sock
12+
listen.owner = $1
13+
listen.group = www-data
14+
listen.mode = 0660
15+
16+
user = $1
17+
group = $1
18+
19+
pm = ondemand
20+
pm.max_children = 8
21+
pm.max_requests = 4000
22+
pm.process_idle_timeout = 10s
23+
pm.status_path = /status
24+
25+
php_admin_value[upload_tmp_dir] = /home/$1/tmp
26+
php_admin_value[session.save_path] = /home/$1/tmp
27+
php_admin_value[open_basedir] = $5:/home/$1/tmp:/bin:/usr/bin:/usr/local/bin:/var/www/html:/tmp:/usr/share:/etc/phpMyAdmin:/etc/phpmyadmin:/var/lib/phpmyadmin:/etc/roundcubemail
28+
php_admin_value[upload_max_filesize] = 80M
29+
php_admin_value[max_execution_time] = 20
30+
php_admin_value[post_max_size] = 80M
31+
php_admin_value[memory_limit] = 256M
32+
php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f info@$2
33+
php_admin_flag[mysql.allow_persistent] = off
34+
php_admin_flag[safe_mode] = off
35+
36+
env[PATH] = /usr/local/bin:/usr/bin:/bin
37+
env[TMP] = /home/$1/tmp
38+
env[TMPDIR] = /home/$1/tmp
39+
env[TEMP] = /home/$1/tmp
40+
"
41+
42+
pool_file_56="/etc/php/5.6/fpm/pool.d/$2.conf"
43+
pool_file_70="/etc/php/7.0/fpm/pool.d/$2.conf"
44+
pool_file_71="/etc/php/7.1/fpm/pool.d/$2.conf"
45+
pool_file_72="/etc/php/7.2/fpm/pool.d/$2.conf"
46+
pool_file_73="/etc/php/7.3/fpm/pool.d/$2.conf"
47+
pool_file_74="/etc/php/7.4/fpm/pool.d/$2.conf"
48+
pool_file_80="/etc/php/8.0/fpm/pool.d/$2.conf"
49+
50+
if [ -f "$pool_file_56" ]; then
51+
rm $pool_file_56
52+
service php5.6-fpm restart
53+
fi
54+
55+
if [ -f "$pool_file_70" ]; then
56+
rm $pool_file_70
57+
service php7.0-fpm restart
58+
fi
59+
60+
if [ -f "$pool_file_71" ]; then
61+
rm $pool_file_71
62+
service php7.1-fpm restart
63+
fi
64+
65+
if [ -f "$pool_file_72" ]; then
66+
rm $pool_file_72
67+
service php7.2-fpm restart
68+
fi
69+
70+
if [ -f "$pool_file_73" ]; then
71+
rm $pool_file_73
72+
service php7.3-fpm restart
73+
fi
74+
75+
if [ ! -f "$pool_file_74" ]; then
76+
echo "$pool_conf" > $pool_file_74
77+
service php7.4-fpm restart
78+
fi
79+
80+
if [ -f "$pool_file_80" ]; then
81+
echo "$pool_conf" > $pool_file_80
82+
service php8.0-fpm restart
83+
fi
84+
85+
exit 0
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<VirtualHost %ip%:%web_ssl_port%>
2+
3+
ServerName %domain_idn%
4+
%alias_string%
5+
ServerAdmin %email%
6+
DocumentRoot %sdocroot%
7+
ScriptAlias /cgi-bin/ %home%/%user%/web/%domain%/cgi-bin/
8+
Alias /vstats/ %home%/%user%/web/%domain%/stats/
9+
Alias /error/ %home%/%user%/web/%domain%/document_errors/
10+
#SuexecUserGroup %user% %group%
11+
CustomLog /var/log/%web_system%/domains/%domain%.bytes bytes
12+
CustomLog /var/log/%web_system%/domains/%domain%.log combined
13+
ErrorLog /var/log/%web_system%/domains/%domain%.error.log
14+
<Directory %home%/%user%/web/%domain%/stats>
15+
AllowOverride All
16+
</Directory>
17+
<Directory %sdocroot%>
18+
AllowOverride All
19+
SSLRequireSSL
20+
Options +Includes -Indexes +ExecCGI
21+
</Directory>
22+
SSLEngine on
23+
SSLVerifyClient none
24+
SSLCertificateFile %ssl_crt%
25+
SSLCertificateKeyFile %ssl_key%
26+
%ssl_ca_str%SSLCertificateChainFile %ssl_ca%
27+
28+
<FilesMatch \.php$>
29+
SetHandler "proxy:unix:/run/php/php8.0-fpm-%domain%.sock|fcgi://localhost"
30+
</FilesMatch>
31+
SetEnvIf Authorization .+ HTTP_AUTHORIZATION=$0
32+
33+
IncludeOptional %home%/%user%/conf/web/%domain%/%web_system%.ssl.conf_*
34+
35+
</VirtualHost>
36+
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<VirtualHost %ip%:%web_port%>
2+
3+
ServerName %domain_idn%
4+
%alias_string%
5+
ServerAdmin %email%
6+
DocumentRoot %docroot%
7+
ScriptAlias /cgi-bin/ %home%/%user%/web/%domain%/cgi-bin/
8+
Alias /vstats/ %home%/%user%/web/%domain%/stats/
9+
Alias /error/ %home%/%user%/web/%domain%/document_errors/
10+
#SuexecUserGroup %user% %group%
11+
CustomLog /var/log/%web_system%/domains/%domain%.bytes bytes
12+
CustomLog /var/log/%web_system%/domains/%domain%.log combined
13+
ErrorLog /var/log/%web_system%/domains/%domain%.error.log
14+
15+
IncludeOptional %home%/%user%/conf/web/%domain%/apache2.forcessl.conf*
16+
17+
<Directory %home%/%user%/web/%domain%/stats>
18+
AllowOverride All
19+
</Directory>
20+
<Directory %sdocroot%>
21+
AllowOverride All
22+
Options +Includes -Indexes +ExecCGI
23+
</Directory>
24+
25+
<FilesMatch \.php$>
26+
SetHandler "proxy:unix:/run/php/php8.0-fpm-%domain%.sock|fcgi://localhost"
27+
</FilesMatch>
28+
SetEnvIf Authorization .+ HTTP_AUTHORIZATION=$0
29+
30+
IncludeOptional %home%/%user%/conf/web/%domain%/%web_system%.conf_*
31+
32+
</VirtualHost>
33+

0 commit comments

Comments
 (0)