Applicable to:
- Plesk for Linux
Question
How to change the PHP version for webmail in Plesk for Linux?
Answer
Note: In Plesk Obsidian, webmail uses PHP 7.4 which comes with Plesk.
Note: Starting from Plesk Obsidian 18.0.39 it is impossible to have webmail without PHP 7.4 even if webmail does not actually use PHP 7.4 (a customized PHP version is used instead). If PHP 7.4 is removed from Tools & Settings > Updates > Add/Remove Components, Plesk Installer will provide a warning that it will remove webmails alongside with PHP 7.4 by dependencies.
Roundcube webmail 1.5.x and later was switched to PHP 8.0 for modern OSes except RHEL 7, CentOS 7, CloudLinux 7, and Ubuntu 18.04 in Plesk Obsidian 18.0.49. Horde webmail does not provide support for PHP 8.0 due to internal limitations. It is recommended to use Roundcube webmail instead.
-
Connect to a Plesk server via SSH.
-
Create a directory for custom configuration templates:
# mkdir -p /usr/local/psa/admin/conf/templates/custom/webmail
-
Copy the original files
roundcube.php
andhorde.php
to the created directory:-
Roundcube:
# cp /usr/local/psa/admin/conf/templates/default/webmail/roundcube.php /usr/local/psa/admin/conf/templates/custom/webmail/
-
Horde:
# cp /usr/local/psa/admin/conf/templates/default/webmail/horde.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-php74-fastcgi 7.4.33
plesk-php80-fastcgi 8.0.25
plesk-php81-fastcgi 8.1.12 -
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 from 'plesk-php74-fastcgi' to any other id from step 4. In this example, we are setting PHP version 8.0:
-
Before
FcgidInitialEnv PP_CUSTOM_PHP_CGI_INDEX plesk-php73-fastcgi
-
After
FcgidInitialEnv PP_CUSTOM_PHP_CGI_INDEX plesk-php74-fastcgi
5.3. Save the changes and close the file.
-
-
Modify the configuration file of Horde:
6.1. Open the horde.php file in a text editor:
# vi /usr/local/psa/admin/conf/templates/custom/webmail/horde.php
6.2. Change the PHP handler from 'plesk-php74-fastcgi' to any other id from step 4. In this example, we are setting PHP version 8.0:
-
Before
FcgidInitialEnv PP_CUSTOM_PHP_CGI_INDEX plesk-php73-fastcgi
-
After
FcgidInitialEnv PP_CUSTOM_PHP_CGI_INDEX plesk-php74-fastcgi
6.3. Save the changes and close the file.
-
-
Regenerate configuration files to apply the changes:
# plesk repair web -y
Comments
4 comments
The article did work for us. We switched to PHP 8.1 without any problem concerning the latest Roundcube 1.6.
Just point 7 of the tutorial is wrong.
... is needed as last step instead of:
... to regenerate the Apache webmail configuration files under "/etc/apache2/plesk.conf.d/webmails/" on our Debian GNU/Linux.
Hello Michael,
Thank you for bringing this to our attention! The article was updated accordingly.
I just updated to CloudLinux 7.9. I guess if I want 8.x I need to start with a new server and migrate.
I want to make this fix, but when I open the roundcube.php file, there is no reference to a PHP version in the file. All I see is variable references such as $roundcubePhpHandler
$roundcubePhpHandler = $VAR->server->webserver->roundcube->phpHandler;
or the following code snippet.
<Files ~ (\.php$)>
SetHandler fcgid-script
FCGIWrapper <?php echo $VAR->server->webserver->apache->phpCgiBin ?> .php
Options +ExecCGI
</Files>
What do I need to do in order to implement this hack?
Hello David,
Roundcube 1.4 doesn't support PHP 8. Due to this, it is not possible to use PHP higher than 7.4 for RHEL 7, CentOS 7, CloudLinux 7, and Ubuntu 18.04. For other modern OSes, Roundcube 1.5 is shipped with PHP 8.0 by default starting from Plesk Obsidian 18.0.49.
In case you would like to use PHP 8 for Roundcube, please consider migrating to one of the OSes which support Roundcube 1.5.
Please sign in to leave a comment.