Browse Source

Add support PHP8.1 (#2233)

* Add support for PHP-8.1

* Add support for php 8.1

* Update /edit/server/index.php with php version

* Add support for tests
Jaap Marcus 4 years ago
parent
commit
2f79dcd7ae

+ 1 - 1
README.md

@@ -19,7 +19,7 @@ Hestia Control Panel is designed to provide administrators an easy to use web an
 Features and Services
 ----------------------------
 * Apache2 and NGINX with PHP-FPM
-* Multiple PHP versions (5.6 - 8.0, 7.4 as default)
+* Multiple PHP versions (5.6 - 8.1, 8.0 as default)
 * DNS Server (Bind) with clustering capabilities
 * POP/IMAP/SMTP mail services with Anti-Virus, Anti-Spam, and Webmail (ClamAV, SpamAssassin, Roundcube, Rainloop)
 * MariaDB and/or PostgreSQL databases

+ 1 - 0
bin/v-restart-service

@@ -69,6 +69,7 @@ for service in $service_list; do
             "$service" = "php7.3-fpm" -o \
             "$service" = "php7.4-fpm" -o \
             "$service" = "php8.0-fpm" -o \
+            "$service" = "php8.1-fpm" -o \
             "$service" = "proftpd" -o    \
             "$service" = "ssh" -o       \
             "$service" = "fail2ban" ]; then

+ 6 - 0
install/deb/multiphp/apache2/PHP-56.sh

@@ -46,6 +46,7 @@ pool_file_72="/etc/php/7.2/fpm/pool.d/$2.conf"
 pool_file_73="/etc/php/7.3/fpm/pool.d/$2.conf"
 pool_file_74="/etc/php/7.4/fpm/pool.d/$2.conf"
 pool_file_80="/etc/php/8.0/fpm/pool.d/$2.conf"
+pool_file_81="/etc/php/8.1/fpm/pool.d/$2.conf"
 
 if [ ! -f "$pool_file_56" ]; then
     echo "$pool_conf" > $pool_file_56
@@ -82,4 +83,9 @@ if [ -f "$pool_file_80" ]; then
     service php8.0-fpm restart
 fi
 
+if [ -f "$pool_file_81" ]; then
+    rm $pool_file_81
+    service php8.1-fpm restart
+fi
+
 exit 0

+ 6 - 0
install/deb/multiphp/apache2/PHP-70.sh

@@ -46,6 +46,7 @@ pool_file_72="/etc/php/7.2/fpm/pool.d/$2.conf"
 pool_file_73="/etc/php/7.3/fpm/pool.d/$2.conf"
 pool_file_74="/etc/php/7.4/fpm/pool.d/$2.conf"
 pool_file_80="/etc/php/8.0/fpm/pool.d/$2.conf"
+pool_file_81="/etc/php/8.1/fpm/pool.d/$2.conf"
 
 if [ -f "$pool_file_56" ]; then
     rm $pool_file_56
@@ -82,4 +83,9 @@ if [ -f "$pool_file_80" ]; then
     service php8.0-fpm restart
 fi
 
+if [ -f "$pool_file_81" ]; then
+    rm $pool_file_81
+    service php8.1-fpm restart
+fi
+
 exit 0

+ 6 - 0
install/deb/multiphp/apache2/PHP-71.sh

@@ -46,6 +46,7 @@ pool_file_72="/etc/php/7.2/fpm/pool.d/$2.conf"
 pool_file_73="/etc/php/7.3/fpm/pool.d/$2.conf"
 pool_file_74="/etc/php/7.4/fpm/pool.d/$2.conf"
 pool_file_80="/etc/php/8.0/fpm/pool.d/$2.conf"
+pool_file_81="/etc/php/8.1/fpm/pool.d/$2.conf"
 
 if [ -f "$pool_file_56" ]; then
     rm $pool_file_56
@@ -82,4 +83,9 @@ if [ -f "$pool_file_80" ]; then
     service php8.0-fpm restart
 fi
 
+if [ -f "$pool_file_81" ]; then
+    rm $pool_file_81
+    service php8.1-fpm restart
+fi
+
 exit 0

+ 6 - 0
install/deb/multiphp/apache2/PHP-72.sh

@@ -46,6 +46,7 @@ pool_file_72="/etc/php/7.2/fpm/pool.d/$2.conf"
 pool_file_73="/etc/php/7.3/fpm/pool.d/$2.conf"
 pool_file_74="/etc/php/7.4/fpm/pool.d/$2.conf"
 pool_file_80="/etc/php/8.0/fpm/pool.d/$2.conf"
+pool_file_81="/etc/php/8.1/fpm/pool.d/$2.conf"
 
 if [ -f "$pool_file_56" ]; then
     rm $pool_file_56
@@ -82,4 +83,9 @@ if [ -f "$pool_file_80" ]; then
     service php8.0-fpm restart
 fi
 
+if [ -f "$pool_file_81" ]; then
+    rm $pool_file_81
+    service php8.1-fpm restart
+fi
+
 exit 0

+ 6 - 0
install/deb/multiphp/apache2/PHP-73.sh

@@ -46,6 +46,7 @@ pool_file_72="/etc/php/7.2/fpm/pool.d/$2.conf"
 pool_file_73="/etc/php/7.3/fpm/pool.d/$2.conf"
 pool_file_74="/etc/php/7.4/fpm/pool.d/$2.conf"
 pool_file_80="/etc/php/8.0/fpm/pool.d/$2.conf"
+pool_file_81="/etc/php/8.1/fpm/pool.d/$2.conf"
 
 if [ -f "$pool_file_56" ]; then
     rm $pool_file_56
@@ -82,4 +83,9 @@ if [ -f "$pool_file_80" ]; then
     service php8.0-fpm restart
 fi
 
+if [ -f "$pool_file_81" ]; then
+    rm $pool_file_81
+    service php8.1-fpm restart
+fi
+
 exit 0

+ 7 - 0
install/deb/multiphp/apache2/PHP-74.sh

@@ -46,6 +46,8 @@ pool_file_72="/etc/php/7.2/fpm/pool.d/$2.conf"
 pool_file_73="/etc/php/7.3/fpm/pool.d/$2.conf"
 pool_file_74="/etc/php/7.4/fpm/pool.d/$2.conf"
 pool_file_80="/etc/php/8.0/fpm/pool.d/$2.conf"
+pool_file_81="/etc/php/8.1/fpm/pool.d/$2.conf"
+
 
 if [ -f "$pool_file_56" ]; then
     rm $pool_file_56
@@ -82,4 +84,9 @@ if [ -f "$pool_file_80" ]; then
     service php8.0-fpm restart
 fi
 
+if [ -f "$pool_file_81" ]; then
+    rm $pool_file_81
+    service php8.1-fpm restart
+fi
+
 exit 0

+ 9 - 3
install/deb/multiphp/apache2/PHP-80.sh

@@ -46,6 +46,7 @@ pool_file_72="/etc/php/7.2/fpm/pool.d/$2.conf"
 pool_file_73="/etc/php/7.3/fpm/pool.d/$2.conf"
 pool_file_74="/etc/php/7.4/fpm/pool.d/$2.conf"
 pool_file_80="/etc/php/8.0/fpm/pool.d/$2.conf"
+pool_file_81="/etc/php/8.1/fpm/pool.d/$2.conf"
 
 if [ -f "$pool_file_56" ]; then
     rm $pool_file_56
@@ -72,14 +73,19 @@ if [ -f "$pool_file_73" ]; then
     service php7.3-fpm restart
 fi
 
-if [ ! -f "$pool_file_74" ]; then
-    echo "$pool_conf" > $pool_file_74
+if [ -f "$pool_file_74" ]; then
+    rm $pool_file_74
     service php7.4-fpm restart
 fi
 
-if [ -f "$pool_file_80" ]; then
+if [ ! -f "$pool_file_80" ]; then
     echo "$pool_conf" > $pool_file_80
     service php8.0-fpm restart
 fi
 
+if [ -f "$pool_file_81" ]; then
+    rm $pool_file_81
+    service php8.1-fpm restart
+fi
+
 exit 0

+ 91 - 0
install/deb/multiphp/apache2/PHP-81.sh

@@ -0,0 +1,91 @@
+#!/bin/bash
+# Adding php pool conf
+user="$1"
+domain="$2"
+ip="$3"
+home_dir="$4"
+docroot="$5"
+
+pool_conf="[$2]
+
+listen = /run/php/php8.0-fpm-$2.sock
+listen.owner = $1
+listen.group = www-data
+listen.mode = 0660
+
+user = $1
+group = $1
+
+pm = ondemand
+pm.max_children = 8
+pm.max_requests = 4000
+pm.process_idle_timeout = 10s
+pm.status_path = /status
+
+php_admin_value[upload_tmp_dir] = /home/$1/tmp
+php_admin_value[session.save_path] = /home/$1/tmp
+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
+php_admin_value[upload_max_filesize] = 80M
+php_admin_value[max_execution_time] = 20
+php_admin_value[post_max_size] = 80M
+php_admin_value[memory_limit] = 256M
+php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f info@$2
+php_admin_flag[mysql.allow_persistent] = off
+php_admin_flag[safe_mode] = off
+
+env[PATH] = /usr/local/bin:/usr/bin:/bin
+env[TMP] = /home/$1/tmp
+env[TMPDIR] = /home/$1/tmp
+env[TEMP] = /home/$1/tmp
+"
+
+pool_file_56="/etc/php/5.6/fpm/pool.d/$2.conf"
+pool_file_70="/etc/php/7.0/fpm/pool.d/$2.conf"
+pool_file_71="/etc/php/7.1/fpm/pool.d/$2.conf"
+pool_file_72="/etc/php/7.2/fpm/pool.d/$2.conf"
+pool_file_73="/etc/php/7.3/fpm/pool.d/$2.conf"
+pool_file_74="/etc/php/7.4/fpm/pool.d/$2.conf"
+pool_file_80="/etc/php/8.0/fpm/pool.d/$2.conf"
+pool_file_81="/etc/php/8.1/fpm/pool.d/$2.conf"
+
+if [ -f "$pool_file_56" ]; then
+    rm $pool_file_56
+    service php5.6-fpm restart
+fi
+
+if [ -f "$pool_file_70" ]; then
+    rm $pool_file_70
+    service php7.0-fpm restart
+fi
+
+if [ -f "$pool_file_71" ]; then
+    rm $pool_file_71
+    service php7.1-fpm restart
+fi
+
+if [ -f "$pool_file_72" ]; then
+    rm $pool_file_72
+    service php7.2-fpm restart
+fi
+
+if [ -f "$pool_file_73" ]; then
+    rm $pool_file_73
+    service php7.3-fpm restart
+fi
+
+if [ ! -f "$pool_file_74" ]; then
+    rm $pool_file_74
+    service php7.4-fpm restart
+fi
+
+if [ -f "$pool_file_80" ]; then
+    rm $pool_file_80
+    service php8.0-fpm restart
+fi
+
+if [ -f "$pool_file_81" ]; then
+    echo "$pool_conf" > $pool_file_81
+    service php8.1-fpm restart
+fi
+
+exit 0

+ 36 - 0
install/deb/multiphp/apache2/PHP-81.stpl

@@ -0,0 +1,36 @@
+<VirtualHost %ip%:%web_ssl_port%>
+
+    ServerName %domain_idn%
+    %alias_string%
+    ServerAdmin %email%
+    DocumentRoot %sdocroot%
+    ScriptAlias /cgi-bin/ %home%/%user%/web/%domain%/cgi-bin/
+    Alias /vstats/ %home%/%user%/web/%domain%/stats/
+    Alias /error/ %home%/%user%/web/%domain%/document_errors/
+    #SuexecUserGroup %user% %group%
+    CustomLog /var/log/%web_system%/domains/%domain%.bytes bytes
+    CustomLog /var/log/%web_system%/domains/%domain%.log combined
+    ErrorLog /var/log/%web_system%/domains/%domain%.error.log
+    <Directory %home%/%user%/web/%domain%/stats>
+        AllowOverride All
+    </Directory>
+    <Directory %sdocroot%>
+        AllowOverride All
+        SSLRequireSSL
+        Options +Includes -Indexes +ExecCGI
+	</Directory>
+    SSLEngine on
+    SSLVerifyClient none
+    SSLCertificateFile %ssl_crt%
+    SSLCertificateKeyFile %ssl_key%
+    %ssl_ca_str%SSLCertificateChainFile %ssl_ca%
+
+    <FilesMatch \.php$>
+        SetHandler "proxy:unix:/run/php/php8.0-fpm-%domain%.sock|fcgi://localhost"
+    </FilesMatch>
+    SetEnvIf Authorization .+ HTTP_AUTHORIZATION=$0
+
+    IncludeOptional %home%/%user%/conf/web/%domain%/%web_system%.ssl.conf_*
+
+</VirtualHost>
+

+ 33 - 0
install/deb/multiphp/apache2/PHP-81.tpl

@@ -0,0 +1,33 @@
+<VirtualHost %ip%:%web_port%>
+
+    ServerName %domain_idn%
+    %alias_string%
+    ServerAdmin %email%
+    DocumentRoot %docroot%
+    ScriptAlias /cgi-bin/ %home%/%user%/web/%domain%/cgi-bin/
+    Alias /vstats/ %home%/%user%/web/%domain%/stats/
+    Alias /error/ %home%/%user%/web/%domain%/document_errors/
+    #SuexecUserGroup %user% %group%
+    CustomLog /var/log/%web_system%/domains/%domain%.bytes bytes
+    CustomLog /var/log/%web_system%/domains/%domain%.log combined
+    ErrorLog /var/log/%web_system%/domains/%domain%.error.log
+        
+    IncludeOptional %home%/%user%/conf/web/%domain%/apache2.forcessl.conf*
+    
+    <Directory %home%/%user%/web/%domain%/stats>
+        AllowOverride All
+    </Directory>
+    <Directory %sdocroot%>
+        AllowOverride All
+        Options +Includes -Indexes +ExecCGI
+    </Directory>
+
+    <FilesMatch \.php$>
+        SetHandler "proxy:unix:/run/php/php8.0-fpm-%domain%.sock|fcgi://localhost"
+    </FilesMatch>
+    SetEnvIf Authorization .+ HTTP_AUTHORIZATION=$0
+
+    IncludeOptional %home%/%user%/conf/web/%domain%/%web_system%.conf_*
+
+</VirtualHost>
+

+ 7 - 0
install/deb/multiphp/nginx/PHP-56.sh

@@ -46,6 +46,7 @@ pool_file_72="/etc/php/7.2/fpm/pool.d/$2.conf"
 pool_file_73="/etc/php/7.3/fpm/pool.d/$2.conf"
 pool_file_74="/etc/php/7.4/fpm/pool.d/$2.conf"
 pool_file_80="/etc/php/8.0/fpm/pool.d/$2.conf"
+pool_file_81="/etc/php/8.1/fpm/pool.d/$2.conf"
 
 if [ ! -f "$pool_file_56" ]; then
     echo "$pool_conf" > $pool_file_56
@@ -82,4 +83,10 @@ if [ -f "$pool_file_80" ]; then
     service php8.0-fpm restart
 fi
 
+if [ -f "$pool_file_81" ]; then
+    rm $pool_file_81
+    service php8.1-fpm restart
+fi
+
+
 exit 0

+ 7 - 0
install/deb/multiphp/nginx/PHP-70.sh

@@ -46,6 +46,7 @@ pool_file_72="/etc/php/7.2/fpm/pool.d/$2.conf"
 pool_file_73="/etc/php/7.3/fpm/pool.d/$2.conf"
 pool_file_74="/etc/php/7.4/fpm/pool.d/$2.conf"
 pool_file_80="/etc/php/8.0/fpm/pool.d/$2.conf"
+pool_file_81="/etc/php/8.1/fpm/pool.d/$2.conf"
 
 if [ -f "$pool_file_56" ]; then
     rm $pool_file_56
@@ -82,4 +83,10 @@ if [ -f "$pool_file_80" ]; then
     service php8.0-fpm restart
 fi
 
+if [ -f "$pool_file_81" ]; then
+    rm $pool_file_81
+    service php8.1-fpm restart
+fi
+
+
 exit 0

+ 7 - 0
install/deb/multiphp/nginx/PHP-71.sh

@@ -46,6 +46,7 @@ pool_file_72="/etc/php/7.2/fpm/pool.d/$2.conf"
 pool_file_73="/etc/php/7.3/fpm/pool.d/$2.conf"
 pool_file_74="/etc/php/7.4/fpm/pool.d/$2.conf"
 pool_file_80="/etc/php/8.0/fpm/pool.d/$2.conf"
+pool_file_81="/etc/php/8.1/fpm/pool.d/$2.conf"
 
 if [ -f "$pool_file_56" ]; then
     rm $pool_file_56
@@ -82,4 +83,10 @@ if [ -f "$pool_file_80" ]; then
     service php8.0-fpm restart
 fi
 
+if [ -f "$pool_file_81" ]; then
+    rm $pool_file_81
+    service php8.1-fpm restart
+fi
+
+
 exit 0

+ 7 - 0
install/deb/multiphp/nginx/PHP-72.sh

@@ -46,6 +46,7 @@ pool_file_72="/etc/php/7.2/fpm/pool.d/$2.conf"
 pool_file_73="/etc/php/7.3/fpm/pool.d/$2.conf"
 pool_file_74="/etc/php/7.4/fpm/pool.d/$2.conf"
 pool_file_80="/etc/php/8.0/fpm/pool.d/$2.conf"
+pool_file_81="/etc/php/8.1/fpm/pool.d/$2.conf"
 
 if [ -f "$pool_file_56" ]; then
     rm $pool_file_56
@@ -82,4 +83,10 @@ if [ -f "$pool_file_80" ]; then
     service php8.0-fpm restart
 fi
 
+if [ -f "$pool_file_81" ]; then
+    rm $pool_file_81
+    service php8.1-fpm restart
+fi
+
+
 exit 0

+ 7 - 0
install/deb/multiphp/nginx/PHP-73.sh

@@ -46,6 +46,7 @@ pool_file_72="/etc/php/7.2/fpm/pool.d/$2.conf"
 pool_file_73="/etc/php/7.3/fpm/pool.d/$2.conf"
 pool_file_74="/etc/php/7.4/fpm/pool.d/$2.conf"
 pool_file_80="/etc/php/8.0/fpm/pool.d/$2.conf"
+pool_file_81="/etc/php/8.1/fpm/pool.d/$2.conf"
 
 if [ -f "$pool_file_56" ]; then
     rm $pool_file_56
@@ -82,4 +83,10 @@ if [ -f "$pool_file_80" ]; then
     service php8.0-fpm restart
 fi
 
+if [ -f "$pool_file_81" ]; then
+    rm $pool_file_81
+    service php8.1-fpm restart
+fi
+
+
 exit 0

+ 6 - 0
install/deb/multiphp/nginx/PHP-74.sh

@@ -46,6 +46,7 @@ pool_file_72="/etc/php/7.2/fpm/pool.d/$2.conf"
 pool_file_73="/etc/php/7.3/fpm/pool.d/$2.conf"
 pool_file_74="/etc/php/7.4/fpm/pool.d/$2.conf"
 pool_file_80="/etc/php/8.0/fpm/pool.d/$2.conf"
+pool_file_81="/etc/php/8.1/fpm/pool.d/$2.conf"
 
 if [ -f "$pool_file_56" ]; then
     rm $pool_file_56
@@ -82,4 +83,9 @@ if [ -f "$pool_file_80" ]; then
     service php8.0-fpm restart
 fi
 
+if [ -f "$pool_file_81" ]; then
+    rm $pool_file_81
+    service php8.1-fpm restart
+fi
+
 exit 0

+ 8 - 3
install/deb/multiphp/nginx/PHP-80.sh

@@ -46,6 +46,7 @@ pool_file_72="/etc/php/7.2/fpm/pool.d/$2.conf"
 pool_file_73="/etc/php/7.3/fpm/pool.d/$2.conf"
 pool_file_74="/etc/php/7.4/fpm/pool.d/$2.conf"
 pool_file_80="/etc/php/8.0/fpm/pool.d/$2.conf"
+pool_file_81="/etc/php/8.1/fpm/pool.d/$2.conf"
 
 if [ -f "$pool_file_56" ]; then
     rm $pool_file_56
@@ -73,13 +74,17 @@ if [ -f "$pool_file_73" ]; then
 fi
 
 if [ -f "$pool_file_74" ]; then
-    echo "$pool_conf" > $pool_file_74
+    rm $pool_file_74
     service php7.4-fpm restart
 fi
-
 if [ ! -f "$pool_file_80" ]; then
-    rm $pool_file_80
+    echo "$pool_conf" > $pool_file_80
     service php8.0-fpm restart
 fi
 
+if [ -f "$pool_file_81" ]; then
+    rm $pool_file_81
+    service php8.1-fpm restart
+fi
+
 exit 0

+ 1 - 1
install/deb/multiphp/nginx/PHP-80.stpl

@@ -27,7 +27,7 @@ server {
                 return  404;
             }
 
-            fastcgi_pass    unix:/run/php/php7.4-fpm-%domain%.sock;
+            fastcgi_pass    unix:/run/php/php8.0-fpm-%domain%.sock;
             fastcgi_index   index.php;
             include         /etc/nginx/fastcgi_params;
         }

+ 1 - 1
install/deb/multiphp/nginx/PHP-80.tpl

@@ -22,7 +22,7 @@ server {
                 return  404;
             }
 
-            fastcgi_pass    unix:/run/php/php7.4-fpm-%domain%.sock;
+            fastcgi_pass    unix:/run/php/php8.0-fpm-%domain%.sock;
             fastcgi_index   index.php;
             include         /etc/nginx/fastcgi_params;
         }

+ 91 - 0
install/deb/multiphp/nginx/PHP-81.sh

@@ -0,0 +1,91 @@
+#!/bin/bash
+# Adding php pool conf
+user="$1"
+domain="$2"
+ip="$3"
+home_dir="$4"
+docroot="$5"
+
+pool_conf="[$2]
+
+listen = /run/php/php7.4-fpm-$2.sock
+listen.owner = $1
+listen.group = www-data
+listen.mode = 0660
+
+user = $1
+group = $1
+
+pm = ondemand
+pm.max_children = 8
+pm.max_requests = 4000
+pm.process_idle_timeout = 10s
+pm.status_path = /status
+
+php_admin_value[upload_tmp_dir] = /home/$1/tmp
+php_admin_value[session.save_path] = /home/$1/tmp
+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
+php_admin_value[upload_max_filesize] = 80M
+php_admin_value[max_execution_time] = 20
+php_admin_value[post_max_size] = 80M
+php_admin_value[memory_limit] = 256M
+php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f info@$2
+php_admin_flag[mysql.allow_persistent] = off
+php_admin_flag[safe_mode] = off
+
+env[PATH] = /usr/local/bin:/usr/bin:/bin
+env[TMP] = /home/$1/tmp
+env[TMPDIR] = /home/$1/tmp
+env[TEMP] = /home/$1/tmp
+"
+
+pool_file_56="/etc/php/5.6/fpm/pool.d/$2.conf"
+pool_file_70="/etc/php/7.0/fpm/pool.d/$2.conf"
+pool_file_71="/etc/php/7.1/fpm/pool.d/$2.conf"
+pool_file_72="/etc/php/7.2/fpm/pool.d/$2.conf"
+pool_file_73="/etc/php/7.3/fpm/pool.d/$2.conf"
+pool_file_74="/etc/php/7.4/fpm/pool.d/$2.conf"
+pool_file_80="/etc/php/8.0/fpm/pool.d/$2.conf"
+pool_file_81="/etc/php/8.1/fpm/pool.d/$2.conf"
+
+if [ -f "$pool_file_56" ]; then
+    rm $pool_file_56
+    service php5.6-fpm restart
+fi
+
+if [ -f "$pool_file_70" ]; then
+    rm $pool_file_70
+    service php7.0-fpm restart
+fi
+
+if [ -f "$pool_file_71" ]; then
+    rm $pool_file_71
+    service php7.1-fpm restart
+fi
+
+if [ -f "$pool_file_72" ]; then
+    rm $pool_file_72
+    service php7.2-fpm restart
+fi
+
+if [ -f "$pool_file_73" ]; then
+    rm $pool_file_73
+    service php7.3-fpm restart
+fi
+
+if [ -f "$pool_file_74" ]; then
+    rm $pool_file_74
+    service php7.4-fpm restart
+fi
+
+if [ -f "$pool_file_80" ]; then
+    rm $pool_file_80
+    service php8.0-fpm restart
+fi
+
+if [ ! -f "$pool_file_81" ]; then
+    echo "$pool_conf" > $pool_file_81
+    service php8.1-fpm restart
+fi
+
+exit 0

+ 53 - 0
install/deb/multiphp/nginx/PHP-81.stpl

@@ -0,0 +1,53 @@
+server {
+    listen      %ip%:%web_ssl_port% ssl http2;
+    server_name %domain_idn% %alias_idn%;
+    root        %sdocroot%;
+    index       index.php index.html index.htm;
+    access_log  /var/log/nginx/domains/%domain%.log combined;
+    access_log  /var/log/nginx/domains/%domain%.bytes bytes;
+    error_log   /var/log/nginx/domains/%domain%.error.log error;
+
+    ssl_certificate      %ssl_pem%;
+    ssl_certificate_key  %ssl_key%;
+    ssl_stapling on;
+    ssl_stapling_verify on;
+
+    include %home%/%user%/conf/web/%domain%/nginx.hsts.conf*;
+
+    location / {
+
+        location ~* ^.+\.(jpeg|jpg|png|webp|gif|bmp|ico|svg|css|js)$ {
+            expires     max;
+            fastcgi_hide_header "Set-Cookie";
+        }
+
+        location ~ [^/]\.php(/|$) {
+            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
+            if (!-f $document_root$fastcgi_script_name) {
+                return  404;
+            }
+
+            fastcgi_pass    unix:/run/php/php7.4-fpm-%domain%.sock;
+            fastcgi_index   index.php;
+            include         /etc/nginx/fastcgi_params;
+        }
+    }
+
+    location /error/ {
+        alias   %home%/%user%/web/%domain%/document_errors/;
+    }
+
+    location ~* "/\.(htaccess|htpasswd)$" {
+        deny    all;
+        return  404;
+    }
+
+    location /vstats/ {
+        alias   %home%/%user%/web/%domain%/stats/;
+        include %home%/%user%/web/%domain%/stats/auth.conf*;
+    }
+
+    include     /etc/nginx/conf.d/phpmyadmin.inc*;
+    include     /etc/nginx/conf.d/phppgadmin.inc*;
+    include     %home%/%user%/conf/web/%domain%/nginx.ssl.conf_*;
+}

+ 48 - 0
install/deb/multiphp/nginx/PHP-81.tpl

@@ -0,0 +1,48 @@
+server {
+    listen      %ip%:%web_port%;
+    server_name %domain_idn% %alias_idn%;
+    root        %docroot%;
+    index       index.php index.html index.htm;
+    access_log  /var/log/nginx/domains/%domain%.log combined;
+    access_log  /var/log/nginx/domains/%domain%.bytes bytes;
+    error_log   /var/log/nginx/domains/%domain%.error.log error;
+        
+    include %home%/%user%/conf/web/%domain%/nginx.forcessl.conf*;
+
+    location / {
+
+        location ~* ^.+\.(jpeg|jpg|png|webp|gif|bmp|ico|svg|css|js)$ {
+            expires     max;
+            fastcgi_hide_header "Set-Cookie";
+        }
+
+        location ~ [^/]\.php(/|$) {
+            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
+            if (!-f $document_root$fastcgi_script_name) {
+                return  404;
+            }
+
+            fastcgi_pass    unix:/run/php/php7.4-fpm-%domain%.sock;
+            fastcgi_index   index.php;
+            include         /etc/nginx/fastcgi_params;
+        }
+    }
+
+    location /error/ {
+        alias   %home%/%user%/web/%domain%/document_errors/;
+    }
+
+    location ~* "/\.(htaccess|htpasswd)$" {
+        deny    all;
+        return  404;
+    }
+
+    location /vstats/ {
+        alias   %home%/%user%/web/%domain%/stats/;
+        include %home%/%user%/web/%domain%/stats/auth.conf*;
+    }
+
+    include     /etc/nginx/conf.d/phpmyadmin.inc*;
+    include     /etc/nginx/conf.d/phppgadmin.inc*;
+    include     %home%/%user%/conf/web/%domain%/nginx.conf_*;
+}

+ 1 - 1
install/hst-install-debian.sh

@@ -26,7 +26,7 @@ VERBOSE='no'
 HESTIA_INSTALL_VER='1.5.0~beta'
 pma_v='5.1.1'
 rc_v="1.5.0"
-multiphp_v=("5.6" "7.0" "7.1" "7.2" "7.3" "7.4" "8.0")
+multiphp_v=("5.6" "7.0" "7.1" "7.2" "7.3" "7.4" "8.0" "8.1")
 fpm_v="8.0"
 mariadb_v="10.6"
 

+ 1 - 1
install/hst-install-ubuntu.sh

@@ -26,7 +26,7 @@ VERBOSE='no'
 HESTIA_INSTALL_VER='1.5.0~beta'
 pma_v='5.1.1'
 rc_v="1.5.0"
-multiphp_v=("5.6" "7.0" "7.1" "7.2" "7.3" "7.4" "8.0")
+multiphp_v=("5.6" "7.0" "7.1" "7.2" "7.3" "7.4" "8.0" "8.1")
 fpm_v="8.0"
 mariadb_v="10.6"
 

+ 24 - 0
test/test.bats

@@ -958,6 +958,30 @@ function check_ip_not_banned(){
     rm $HOMEDIR/$user/web/$multi_domain/public_html/php-test.php
 }
 
+@test "Multiphp: Change backend version - PHP v8.1" {
+    test_phpver='8.1'
+    multi_domain="multiphp.${domain}"
+
+    if [ ! -d "/etc/php/${test_phpver}/fpm/pool.d/" ]; then
+        skip "PHP ${test_phpver} not installed"
+    fi
+
+    run v-change-web-domain-backend-tpl $user $multi_domain 'PHP-8_0' 'yes'
+    assert_success
+    refute_output
+
+    # Changing web backend will create a php-fpm pool config in the corresponding php folder
+    assert_file_exist "/etc/php/${test_phpver}/fpm/pool.d/${multi_domain}.conf"
+
+    # A single php-fpm pool config file must be present
+    num_fpm_config_files="$(find -L /etc/php/ -name "${multi_domain}.conf" | wc -l)"
+    assert_equal "$num_fpm_config_files" '1'
+
+    echo -e "<?php\necho 'hestia-multiphptest:'.PHP_MAJOR_VERSION.'.'.PHP_MINOR_VERSION;" > "$HOMEDIR/$user/web/$multi_domain/public_html/php-test.php"
+    validate_web_domain $user $multi_domain "hestia-multiphptest:$test_phpver" 'php-test.php'
+    rm $HOMEDIR/$user/web/$multi_domain/public_html/php-test.php
+}
+
 @test "Multiphp: Cleanup" {
     multi_domain="multiphp.${domain}"
 

+ 1 - 0
web/edit/server/index.php

@@ -72,6 +72,7 @@ $v_php_versions = [
      'php-7.3',
      'php-7.4',
      'php-8.0',
+     'php-8.1',
 ];
 sort($v_php_versions);