安装swoole时遇到的 Warning: PHP Startup: Unable to load dynamic library ‘/opt/lampp/lib/php/extensions/no-debug-non-zts-20160303/swoole.so’ – /opt/lampp/lib/libstdc++.so.6: version `GLIBCXX_3.4.20′ not found (required by /opt/lampp/lib/php/extensions/no-debug-non-zts-20160303/swoole.so) in Unknown on line 0 问题
使用的时linux的xampp集成环境,集成环境默认安装在/opt/lampp下
/opt/lampp/bin/pecl install swoole
安装成功
vim /opt/lampp/etc/php.ini
增加extension=swoole.so后
/opt/lampp/bin/php -m
报错:Warning: PHP Startup: Unable to load dynamic library ‘/opt/lampp/lib/php/extensions/no-debug-non-zts-20160303/swoole.so’ – /opt/lampp/lib/libstdc++.so.6: version `GLIBCXX_3.4.20′ not found (required by /opt/lampp/lib/php/extensions/no-debug-non-zts-20160303/swoole.so) in Unknown on line 0
libstdc++.so.6的版本过低
sudo find / -name libstdc++.so.6*
查找一下发现,只是xampp集成环境的libstdc++.so.6的版本过低
strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 |grep GLIBCXX
strings /opt/lampp/lib/libstdc++.so.6 | grep GLIBCXX
cp -r /usr/lib/x86_64-linux-gnu/libstdc++.so.6 /opt/lampp/lib/libstdc++.so.6
直接拷贝新的版本
问题解决