[Solved] PHP -v Error: error while loading shared libraries: libonig.so.5:cannot open share directory

When upgrading from PHP 5.6 to PHP 7.4, you can directly replace the compiled installation package. When you enter PHP – V, you will report an error while loading shared libraries: libonig. So. 5: cannot open share directory

#php -v
#php: error while loading shared libraries: libonig.so.5:cannot open share directory

Solution:

Step 1

Modify /ect/ld.so.conf     Add the following line

#vim /etc/ld.so.conf
include ls.so.conf.d/*.conf
/usr/local/lib
/usr/local/x264/lib
/usr/local/openssl/lib
/usr/local/python3.7.1/lib

After saving   Execute ldconfig

#ldconfig

Step 2:

Install oniguruma library

Download Link:

https://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/o/oniguruma-devel-6.8.2-1.el7.x86_64.rpm

https://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/o/oniguruma-6.8.2-1.el7.x86_64.rpm

oniguruma-6.8.2-1.el7.x86 64.rpm

oniguruma-devel-6.8.2-1.el7.x86 64.rpm

Use the follow commands to install:

#rpm -ivh oniguruma-devel-6.8.2-1.el7.x86_64
#rpm -ivh oniguruma-6.8.2-1.el7.x86_64

Then run the command PHP – V     Perfect display

If installation error

Generating autotools files.
./autogen.sh: line 6: autoreconf: command not found

Solution:

[[email protected] oniguruma-6.9.4]# yum install autoconf automake libtool

Read More: