3

I just ran apt-get update and upgrade to get the latest updates for my Debian stable server. It included a bunch of PHP5 updates. One (libapache2-mod-php5) threw an error: ERROR: php5 module already enabled, not enabling php5.

Also, Apache was not restarted so the PHP5 updates had no effect. I restarted Apache manually and all was well.

Is this a bug in the update script or is my server messed up?

Here are the last lines of the apt-get upgrade output:

Setting up mysql-client (5.5.49-0+deb8u1) ... Setting up openssh-client (1:6.7p1-5+deb8u2) ... Setting up openssh-sftp-server (1:6.7p1-5+deb8u2) ... Setting up openssh-server (1:6.7p1-5+deb8u2) ... Setting up php5-common (5.6.20+dfsg-0+deb8u1) ... Setting up php5-xmlrpc (5.6.20+dfsg-0+deb8u1) ... Setting up php5-tidy (5.6.20+dfsg-0+deb8u1) ... Setting up php5-cli (5.6.20+dfsg-0+deb8u1) ... Setting up php5-readline (5.6.20+dfsg-0+deb8u1) ... Setting up php5-mysql (5.6.20+dfsg-0+deb8u1) ... Setting up php5-gmp (5.6.20+dfsg-0+deb8u1) ... Setting up php5-gd (5.6.20+dfsg-0+deb8u1) ... Setting up php5-curl (5.6.20+dfsg-0+deb8u1) ... Setting up libapache2-mod-php5 (5.6.20+dfsg-0+deb8u1) ... ERROR: php5 module already enabled, not enabling php5 Setting up linux-libc-dev:amd64 (3.16.7-ckt25-2) ... Setting up php-pear (5.6.20+dfsg-0+deb8u1) ... Installing new version of config file /etc/pear/pear.conf ... Processing triggers for libc-bin (2.19-18+deb8u4) ...

2

I just took a look into the postinst-maintainer-script /var/lib/dpkg/info/libapache2-mod-php5.postinst. It states:

php5_enable() {
    PHP_MODULE=$(a2query -m | sed -n 's/^\(php[\.0-9]*\) (enabled.*)/\1/p')
    if [ -n "$PHP_MODULE" -a "$PHP_MODULE" != "php@PHP_VERSION@" ]; then
        apache2_msg err "ERROR: $PHP_MODULE module already enabled, not enabling php5"
        return 1
    fi

I couldn't figure out where @PHP_VERSION@ is set so I replaced it with "5":

php5_enable() {
    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

After that I run:

% sudo dpkg-reconfigure libapache2-mod-php5
apache2_invoke php5: already enabled

which is a much nicer output. Although (seemingly) harmless it seems like a bug to me. The Debian BTS holds no information about that error. You should consider reporting it.

  • 2
    Good catch. I will fix that in next security upload. This scripts ensures that the postinst will not enable two PHP modules at the same time. Mostly for jessie->stretch updates. Fortunately it's harmless for jessie users. – oerdnj Jun 17 '16 at 9:24
0

This is not really an error. The script just assumes that the php5 module in your Apache2 instance is not enabled (and tries to enable it), and because of that it gives you this message (which imho should probably be a warning, if not just an information, since the service still works fine).

As for the service restart - the Apache wasn't restarted most likely because of that 'error'.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.