Plesk

How to change PHP version for webmail in 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 external limitations. It is recommended to use Roundcube webmail instead.

  1. Connect to a Plesk server via SSH.

  2. Create a directory for custom configuration templates:

    # mkdir -p /usr/local/psa/admin/conf/templates/custom/webmail

  3. Copy the original files roundcube.php and horde.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/

  4. 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

  5. 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.

  6. 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.

  7. Regenerate configuration files to apply the changes:

    # plesk repair web -y

Exit mobile version