• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

Issue Dependency troubles with PHP5 and mpm_event.

Tozz

Regular Pleskian
Description
There is an issue when using Plesk on Debian/Ubuntu machines and Apache running in mpm event (instead of the more commonly used mpm prefork). When there are updates to PHP delivered by the Debian package maintainers the libapache2-mod-php5 is also updated. This causes the libapache2-mod-php5.postinst script to run.

This script restores the Apache MPM back to prefork, even though MPM Event is configured. This is caused by /var/lib/dpkg/info/libapache2-mod-php5.postinst line 15 to 21:

Code:
        mpm=$(a2query -M)
        case "$(a2query -M)" in
            prefork|itk) return 0;;
            *) if apache2_switch_mpm prefork; then return 0; fi;;
        esac
        apache2_msg err "Could not switch to prefork MPM, not enabling php5"
        return 1

My initial idea to resolve this issue is to simply uninstall package libapache2-mod-php5. However, this is impossible because Plesk depends on it:

Code:
# apt-get remove libapache2-mod-php5
Reading package lists... Done
Building dependency tree   
Reading state information... Done
The following packages will be REMOVED:
  libapache2-mod-php5 psa-php5-configurator psa-phpfpm-configurator
0 upgraded, 0 newly installed, 3 to remove and 0 not upgraded.
After this operation, 10.1 MB disk space will be freed.
Do you want to continue? [Y/n]

I believe this is a bug in Plesk, because Plesk should not depend on this package because it is perfectly possible (and getting more and more common) to run PHP as (F)CGI or FPM instead of the Apache module.

Version
CPU Intel(R) Xeon(R) CPU E5-2609 v2 @ 2.50GHz (4 core(s))
Version Plesk v12.5.30_build1205150826.19 os_Debian 8.0
OS Debian 8.5

How to reproduce?

  1. Run Apache in mpm_event
  2. Wait for a PHP update from Debian, install the update (or manually run the postinst script)
  3. Notice you are now running mpm_prefork instead of mpm_event

Expected result:
The Apache MPM should not change. I believe this is a bug in Plesk because:

  1. The whole idea of libapache2-mod-php5 is to install the PHP5 module in Apache. So I think it is logical that the postinst script for this package changes the mpm to a mpm that is capable of running PHP.
  2. I therefor believe this is not an issue in the postinst scripts for this package.
  3. There is no reason for Plesk to depend on libapache2-mod-php5 when the server is running in mpm_event and has the PHP5 module disabled.
  4. Thus, Plesk should not depend on this package.

Actual result:
The Apache MPM is changed back to prefork when installing PHP updates.

Fix
None :)

A temporary fix is to hold back updates for this package, but that is not ideal.
 
Actually, this issue has already been reported as a Debian bug: https://bugs.debian.org/799630
Unfortunately no fix is available as of now.

For the time being, I'm using the following workaround:
The postinst script contains a check for a different version of the php module:
Code:
        PHP_MODULE=$(a2query -m | sed -n 's/^\(php[\.0-9]*\) (enabled.*)/\1/p')
        if [ -n "$PHP_MODULE" -a "$PHP_MODULE" != "php5" ]; then
            apache2_msg err "ERROR: $PHP_MODULE module already enabled, not enabling php5"
            return 1
        fi
and it won't change anything in the apache configuration if it finds one.

So I just created a dummy file /etc/apache2/mods-available/php0.load which does not contain any LoadModule directive but just a comment as to its purpose. When this "module" is enabled via
Code:
a2enmod php0
it does not actually add anything to the apache configuration, but it keeps the mod_php5 postinst script from changing the mpm to prefork (and enabling mod_php5).
 
Back
Top