我尝试了几天来安装php没有任何运气。通常需要2分钟的过程。我有CentOS 7.4.1708和Apache2.4.6。
使用yum install php安装php并运行命令php -v时,将得到错误php: /lib64/libcrypto.so.10: version OPENSSL_1.0.2 not found (required by php)。
当我运行命令rpm -qi openssl时
我得到了package openssl is not installed
当我运行openssl version时
我得到了OpenSSL 1.0.1e-fips 11 Feb 2013
当我运行命令yum info openssl时
Available Packages Name : openssl Arch : x86_64 Epoch : 1 Version : 1.0.2k Release : 8.el7 Size : 492 k Repo : base/7/x86_64 Summary : Utilities from the general purpose cryptography library with TLS implementation URL : http://www.openssl.org/ License : OpenSSL Description : The OpenSSL toolkit provides support for secure communications between : machines. OpenSSL includes a certificate management tool and shared : libraries which provide various cryptographic algorithms and : protocols.
yum info php给
Available Packages Name : php Arch : x86_64 Version : 5.4.16 Release : 43.el7_4.1 Size : 1.4 M Repo : updates/7/x86_64 Summary : PHP scripting language for creating dynamic web sites URL : http://www.php.net/ License : PHP and Zend and BSD Description : PHP is an HTML-embedded scripting language. PHP attempts to make it : easy for developers to write dynamically generated web pages. PHP also : offers built-in database integration for several commercial and : non-commercial database management systems, so writing a : database-enabled webpage with PHP is fairly simple. The most common : use of PHP coding is probably as a replacement for CGI scripts. : : The php package contains the module (often referred to as mod_php) : which adds support for the PHP language to Apache HTTP Server.
yum update openssl的输出是
Loaded plugins: fastestmirror, priorities
base | 3.6 kB 00:00:00
cm-rhel7-8.0 | 1.3 kB 00:00:00
cm-rhel7-8.0-updates | 1.3 kB 00:00:00
epel/x86_64/metalink | 29 kB 00:00:00
extras | 3.4 kB 00:00:00
updates | 3.4 kB 00:00:00
webtatic | 3.6 kB 00:00:00
Loading mirror speeds from cached hostfile
* base: centos.mirroring.pulsant.co.uk
* cm-rhel7-8.0: updates-eu.brightcomputing.com
* cm-rhel7-8.0-updates: updates-eu.brightcomputing.com
* epel: www.mirrorservice.org
* extras: centos.mirroring.pulsant.co.uk
* updates: centos.mirroring.pulsant.co.uk
* webtatic: uk.repo.webtatic.com
101 packages excluded due to repository priority protections
No packages marked for update以下是命令ldd /lib64/libcrypto.so.10的输出
命令linux-vdso.so.1 => (0x00002aaaaaaab000) libdl.so.2 => /lib64/libdl.so.2 (0x00002aaaaaea8000) libz.so.1 => /lib64/libz.so.1 (0x00002aaaab0ac000) libc.so.6 => /lib64/libc.so.6 (0x00002aaaab2c3000) /lib64/ld-linux-x86-64.so.2 (0x0000555555554000)输出openssl version -a
openssl: /lib64/libcrypto.so.10: version `OPENSSL_1.0.2' not found (required by openssl)这里是which openssl的输出,/usr/bin/openssl输出的env | grep LD_是空的。
好的,我正在继续,使用这个命令yum reinstall openssl openssl-libs,错误就消失了。我想现在有个小问题。php -v的输出为PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/zip.so' - libzip.so.2: cannot open shared object file: No such file or directory in Unknown on line 0 PHP 5.4.16 (cli) (built: Mar 7 2018 13:34:47) Copyright (c) 1997-2013 The PHP Group Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
如何获得正确版本的php和openssl以消除错误?
发布于 2018-07-11 14:57:33
使它在Centos 7上工作
yum install -y php php-common
yum reinstall -y openssl openssl-libs
systemctl restart httpd
发布于 2021-10-01 23:36:04
要解决您的问题,以下命令应该会有所帮助:
yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm -y
yum reinstall openssl openssl-libs -y
yum reinstall libzip -y
yum install https://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum-config-manager --enable remi-php54
yum install php php-common php-pecl-zip -y但是,自昨天以来,openssl版本小于1.1.0的客户端将不允许让人加密证书。对于centos 7,它的最佳实践是从源代码安装最新版本的openssl,因为它不存在于任何yum存储库中,您可以使用这个脚本来实现它:
yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm -y
yum groupinstall -y "Development Tools" "Development Libraries"
cd /usr/src
wget --no-check-certificate https://www.openssl.org/source/openssl-1.1.1l.tar.gz
tar -zxf openssl-1.1.1l.tar.gz
cd openssl-1.1.1l
./config
make
make install
mv /usr/local/lib64/libcrypto.so.1.1 /usr/local/lib64/libssl.so.1.1 /usr/lib64/
yum install php php-common -y
yum install ca-certificates -y
systemctl restart httpd另外,我建议您至少安装php的7+version,而不是非常不推荐的5.4,您可以这样做:
yum install https://rpms.remirepo.net/enterprise/remi-release-7.rpm -y
yum-config-manager --disable 'remi-php*'
yum-config-manager --enable remi-php74
yum install php php-common -y # and others packages you needhttps://serverfault.com/questions/909022
复制相似问题