今天在一台机器上运行pecl install swoole时报了一堆错
Warning: Invalid argument supplied for foreach() in Command.php on line 249
Warning: Invalid argument supplied for foreach() in /usr/share/pear/PEAR/Command.php on line 249
Warning: Invalid argument supplied for foreach() in Command.php on line 249
Warning: Invalid argument supplied for foreach() in /usr/share/pear/PEAR/Command.php on line 249
Warning: Invalid argument supplied for foreach() in Command.php on line 249
...
Warning: Invalid argument supplied for foreach() in /usr/share/pear/PEAR/Command.php on line 249
XML Extension not found
问题所在
安装PHP时没有启用xml模块,因为当PECL尝试使用它的XMLParser.php类时,它失败了,因为它无法访问XML扩展。
解决办法
1、重新编译PHP并加上./configure --disable-xml
2、编辑pecl文件
vim pecl
将-n去掉