libapache2-mod-php7.0 无法在 Debian Stretch 上运行

libapache2-mod-php7.0 无法在 Debian Stretch 上运行

我正在尝试在 Debian 9.4 上安装 PHP 7.0。当我安装时,libapache2-mod-php7.0出现以下错误。

    Syntax error on line 141 of /etc/apache2/apache2.conf: Syntax error on line 3 of /etc/apache2/mods-enabled/php7.0.load: Cannot load /usr/lib/apache2/modules/libphp7.0.so into server: /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1: version `OPENSSL_1_1_0' not found (required by /usr/lib/apache2/modules/libphp7.0.so)

如果我运行 lddlibphp7.0.so我得到

    linux-vdso.so.1 (0x00007ffce37eb000)
    libcrypt.so.1 => /lib/x86_64-linux-gnu/libcrypt.so.1 (0x00007fbb967b7000)
    libresolv.so.2 => /lib/x86_64-linux-gnu/libresolv.so.2 (0x00007fbb965a0000)
    libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fbb96386000)
    libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007fbb96113000)
    librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fbb95f0b000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fbb95c07000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fbb95a03000)
    libnsl.so.1 => /lib/x86_64-linux-gnu/libnsl.so.1 (0x00007fbb957eb000)
    libxml2.so.2 => /usr/lib/x86_64-linux-gnu/libxml2.so.2 (0x00007fbb95430000)
    libssl.so.1.1 => /usr/lib/x86_64-linux-gnu/libssl.so.1.1 (0x00007fbb951c4000)
    libcrypto.so.1.1 => /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1 (0x00007fbb94dc8000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fbb94a29000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fbb9480c000)
    /lib64/ld-linux-x86-64.so.2 (0x00007fbb97026000)
    libicui18n.so.57 => /usr/lib/x86_64-linux-gnu/libicui18n.so.57 (0x00007fbb94392000)
    libicuuc.so.57 => /usr/lib/x86_64-linux-gnu/libicuuc.so.57 (0x00007fbb93fea000)
    libicudata.so.57 => /usr/lib/x86_64-linux-gnu/libicudata.so.57 (0x00007fbb9256d000)
    liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007fbb92347000)
    libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fbb91fc5000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fbb91dae000)

如果我跑步ls -l /usr/lib/x86_64-linux-gnu/ | grep crypto我会得到

    -rw-r--r--  1 root root  4811326 Mar 29 06:51 libcrypto.a
    -rw-r--r--  1 root root 11735850 Jun  5  2017 libcrypto++.a
    lrwxrwxrwx  1 root root       13 Jun  5  2017 libcryptopp.a ->                          libcrypto++.a
    lrwxrwxrwx  1 root root       14 Jun  5  2017 libcryptopp.so ->libcrypto++.so
    lrwxrwxrwx  1 root root       16 Jun  5  2017 libcryptopp.so.6 -> libcrypto++.so.6
    lrwxrwxrwx  1 root root       16 Mar 29 06:51 libcrypto.so ->libcrypto.so.1.1
    lrwxrwxrwx  1 root root       20 Jun  5  2017 libcrypto++.so ->libcrypto++.so.6.0.0
    lrwxrwxrwx  1 root root       16 Apr 14 16:09 libcrypto.so.1.0.0 ->libcrypto.so.1.1
    -rw-r--r--  1 root root  2492224 Mar 29 07:10 libcrypto.so.1.0.2
    -rw-r--r--  1 root root  2066816 Apr 14 15:48 libcrypto.so.1.1
    lrwxrwxrwx  1 root root       20 Jun  5  2017 libcrypto++.so.6 ->libcrypto++.so.6.0.0
    -rw-r--r--  1 root root  3667096 Jun  5  2017 libcrypto++.so.6.0.0
    lrwxrwxrwx  1 root root       18 Aug  9  2017 libk5crypto.so.3 ->libk5crypto.so.3.1
    -rw-r--r--  1 root root   203656 Aug  9  2017 libk5crypto.so.3.1

我可以提供更多信息来帮助别人为我指明正确的方向。我在这里不知所措。看起来我有正确版本的 libcrypto,但 PHP 不支持它。

答案1

只是看一下相当长的错误消息:

Syntax error on line 141 of /etc/apache2/apache2.conf: Syntax error on line 3 of /etc/apache2/mods-enabled/php7.0.load: Cannot load /usr/lib/apache2/modules/libphp7.0.so into server: /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1: version `OPENSSL_1_1_0' not found (required by /usr/lib/apache2/modules/libphp7.0.so)

人们可以轻松找到根本原因:

OPENSSL_1_1_0 not found (required...)

换句话说,要么您没有openssl安装软件包的版本,要么它已经过时。


您可以通过运行以下命令来验证这一点:

apt-cache policy openssl

就我而言,它的安装位置和最新版本显示:

openssl:
  Installed: 1.1.0f-3+deb9u2
  Candidate: 1.1.0f-3+deb9u2
  Version table:
 *** 1.1.0f-3+deb9u2 500
        500 http://security.debian.org stretch/updates/main amd64 Packages
        100 /var/lib/dpkg/status
     1.1.0f-3+deb9u1 500
        500 http://deb.debian.org/debian stretch/main amd64 Packages

相关内容