Question
How to change the PHP version for webmail in Plesk for Linux?
Answer
Note: Roundcube webmail now uses PHP 8.3 in Plesk on all supported OSes except RHEL 7, CentOS 7, CloudLinux 7 and Ubuntu 18.04.
Note: Horde webmail does not provide support for PHP 8.0 and later versions due to external limitations. It uses the latest supported PHP version - 7.4. For security reasons, we recommend to switch to Roundcube webmail instead.
-
Connect to your Plesk server via SSH.
-
Create a directory for custom configuration templates:
# mkdir -p /usr/local/psa/admin/conf/templates/custom/webmail
-
Copy original file
roundcube.php
to the created directory:# cp /usr/local/psa/admin/conf/templates/default/webmail/roundcube.php /usr/local/psa/admin/conf/templates/custom/webmail/
-
Run the command below to list all available PHP versions. If a required PHP version is not listed, install it using the steps from this KB article.
# plesk bin php_handler --list | grep fastcgi
id: display name:
plesk-php83-fastcgi 8.3.16
plesk-php84-fastcgi 8.4.3 -
Modify the configuration file of Roundcube:
5.1. Open the roundcube.php file in a text editor. In this example, we are using the vi editor:
# vi /usr/local/psa/admin/conf/templates/custom/webmail/roundcube.php
5.2. Change the PHP handler to any other id from step 4. In this example, we are setting PHP version 8.4:
-
Before
FcgidInitialEnv PP_CUSTOM_PHP_CGI_INDEX "<?php echo $roundcubePhpHandler; ?>"
-
After
FcgidInitialEnv PP_CUSTOM_PHP_CGI_INDEX plesk-php84-fastcgi
5.3. Save the changes and close the file.
-
-
Regenerate configuration files to apply the changes:
# plesk repair web -server -y