Docker环境使用centos镜像安装Swoole时出现了Unable to load dynamic library 'swoole.so'
的错误。报错信息路径的文件其实是存在的,但依然提示该问题。详细报错如下:
[root@f240a16bb2c8 /]# php -m | grep swoole
PHP Warning: PHP Startup: Unable to load dynamic library 'swoole.so' (tried: /usr/local/lib/php/extensions/debug-non-zts-20170718/swoole.so (libnghttp2.so.14: cannot open shared object file: No such file or directory), /usr/local/lib/php/extensions/debug-non-zts-20170718/swoole.so.so (/usr/local/lib/php/extensions/debug-non-zts-20170718/swoole.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
经过查找,发现一个解决方法(来源:https://www.imooc.com/wenda/detail/387830 by 永远_)
编辑/etc/ld.so.conf
添加一行/usr/local/lib,保存后执行ldconfig
命令即可。
具体原理待后续详查。