大网数据广告活动
服务器运维问答

Debian: error in upgrade script?

· 52CE 我爱测

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 . A…

问题原文

原帖链接 · RonaldPK · CC BY-SA 3.0

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

已采纳解答

原帖链接 · dpat · CC BY-SA 3.0

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.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-04-28)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。