Unable to load dynamic library 'zip.so' on Centos 7.6.1810 using remi-php72 repo

Plastopian picture Plastopian · Jan 19, 2019 · Viewed 9.8k times · Source

I am having problems getting October CMS to update:

Update failed "Class 'ZipArchive' not found" on line 51 of /var/www/html/jdd/htdocs/vendor/october/rain/src/Filesystem/Zip.php

And if I do php -m, i get the following warning:

PHP Warning: PHP Startup: Unable to load dynamic library 'zip.so' (tried: /usr/lib64/php/modules/zip.so (/usr/lib64/php/modules/zip.so: undefined symbol: zip_libzip_version), /usr/lib64/php/modules/zip.so.so (/usr/lib64/php/modules/zip.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0

Strange thing is, in my /etc/php.d/ folder, the zip.ini file contains the line: extension=zip.so. whereas all other .ini files in /php.d do not include the ".so" extension (eg: for the json.ini file, the line reads: extension=json). I have tried removing the ".so" from the zip.ini extension= line, but it still won't work.

As far as I know, the system is only running x86_64 executables (how do I check this with absolute certainty - all binaries are showing as .x86_64 or .noarch?).

I have tried other versions of php: -php 5.4 installs zip.so fine (it loads correctly), except October requires at least php 7.0. -php 7.0 to 7.3 all install zip.so, but the extension still does not load.

Can anyone help?

Answer

Eugene Zadorin picture Eugene Zadorin · Apr 23, 2019

I've got the same problem and found following solution:

  1. Search for installed php modules:

yum list installed | grep php*

  1. Try to locate installed php-zip module:

rpm -ql php72-php-pecl-zip

  1. You will see something like this:
/etc/opt/remi/php72/php.d/40-zip.ini
/opt/remi/php72/root/usr/lib64/php/modules/zip.so # <----
/opt/remi/php72/root/usr/share/doc/pecl/zip
  1. Then just create symlink to this file in directory where php searches modules by default:

ln -s /opt/remi/php72/root/usr/lib64/php/modules/zip.so /usr/lib64/php/modules/zip.so

After this steps I finally saw zip extension in php -m output and now can use class ZipArchive.

Also you should probably restart your httpd service.