Linux – Getting error when installing php in Centos 7.4 OPENSSL_1.0.2

apache-2.4centoslinuxopensslPHP

I am trying for a couple of days to install php without any luck. The process which usually takes 2 minutes. I have CentOS 7.4.1708 and Apache 2.4.6.
When I install php using yum install php and run the command
php -v I get the error php: /lib64/libcrypto.so.10: version OPENSSL_1.0.2 not found (required by php)
When I run command rpm -qi openssl
I get package openssl is not installed
When I run openssl version
I get OpenSSL 1.0.1e-fips 11 Feb 2013
When I run command yum info openssl
I get

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

The output of yum update openssl is

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

Here is the output of command 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)

Output of command openssl version -a

openssl: /lib64/libcrypto.so.10: version `OPENSSL_1.0.2' not found (required by openssl)

Here is the output of which openssl

/usr/bin/openssl

Output of env | grep LD_ is empty.

Okay I am getting forward, with this command yum reinstall openssl openssl-libs
That error is gone. Now there is small issue I think. The output of php -v is

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

How to get the correct version of php and openssl to get rid of the error?

Best Answer

To make it work on Centos 7

yum install -y php php-common

yum reinstall -y openssl openssl-libs

systemctl restart httpd