CENTOS8出现PHP ZIP.SO扩展读取错误的解决办法

php错误日志中出现: PHP Warning: PHP Startup: Unable to load dynamic lib
rary ‘zip’ (tried: /usr/lib64/php/modules/zip (/usr/lib64/php/modules/zip: canno
t open shared object file: No such file or directory), /usr/lib64/php/modules/zi
p.so (/usr/lib64/php/modules/zip.so: undefined symbol: _call_user_function_ex))
in Unknown on line 0

使用php -m|grep zip命令,发现zip未加载。

解决办法:

#yum install php-zip

或者

#dnf install php-zip

然后重启,systemctl restart httpd

#php -m|grep zip

zip

显示加载成功!

但在错误日志中显示:PHP Warning: Module “zip” is already loaded in U
nknown on line 0
说明重复加载失败,在/etc/php.d目录下,发现有20-zip.ini和40-zip.ini文件,删除20-zip.ini,重新启动httpd搞定!