Pear error “XML Extension not found” on Ubuntu 14.04 after installing php-xml & php-xml7.0

折月煮酒 提交于 2020-02-27 05:26:29

问题


I wanna use the pecl command to install redis to my php on Ubuntu 14.04. But my Pear is giving me a list of warnings:

Warning: Invalid argument supplied for foreach() in Command.php on line 249

Warning: Invalid argument supplied for foreach() in /usr/share/php/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/php/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/php/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/php/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/php/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/php/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/php/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/php/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/php/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/php/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/php/PEAR/Command.php on line 249

Notice: Undefined index: honorsbaseinstall in Role.php on line 173

Notice: Undefined index: honorsbaseinstall in Role.php on line 173

Notice: Undefined index: honorsbaseinstall in Role.php on line 173

Notice: Undefined index: honorsbaseinstall in Role.php on line 173

Notice: Undefined index: honorsbaseinstall in Role.php on line 173

Notice: Undefined index: honorsbaseinstall in Role.php on line 173

Notice: Undefined index: honorsbaseinstall in Role.php on line 173

Notice: Undefined index: honorsbaseinstall in Role.php on line 173

Notice: Undefined index: honorsbaseinstall in Role.php on line 173

Notice: Undefined index: honorsbaseinstall in Role.php on line 173

Notice: Undefined index: installable in Role.php on line 139

Notice: Undefined index: installable in Role.php on line 139

Notice: Undefined index: installable in Role.php on line 139

Notice: Undefined index: installable in Role.php on line 139

Notice: Undefined index: installable in Role.php on line 139

Notice: Undefined index: installable in Role.php on line 139

Notice: Undefined index: installable in Role.php on line 139

Notice: Undefined index: installable in Role.php on line 139

Notice: Undefined index: installable in Role.php on line 139

Notice: Undefined index: installable in Role.php on line 139

Notice: Undefined index: phpfile in Role.php on line 204

Notice: Undefined index: phpfile in Role.php on line 204

Notice: Undefined index: phpfile in Role.php on line 204

Notice: Undefined index: phpfile in Role.php on line 204

Notice: Undefined index: phpfile in Role.php on line 204

Notice: Undefined index: phpfile in Role.php on line 204

Notice: Undefined index: phpfile in Role.php on line 204

Notice: Undefined index: phpfile in Role.php on line 204

Notice: Undefined index: phpfile in Role.php on line 204

Notice: Undefined index: phpfile in Role.php on line 204

Notice: Undefined index: config_vars in Role.php on line 46

Notice: Undefined index: config_vars in Role.php on line 46

Notice: Undefined index: config_vars in Role.php on line 46

Notice: Undefined index: config_vars in Role.php on line 46

Notice: Undefined index: config_vars in Role.php on line 46

Notice: Undefined index: config_vars in Role.php on line 46

Notice: Undefined index: config_vars in Role.php on line 46

Notice: Undefined index: config_vars in Role.php on line 46

Notice: Undefined index: config_vars in Role.php on line 46

Notice: Undefined index: config_vars in Role.php on line 46

Warning: Invalid argument supplied for foreach() in PEAR/Command.php on line 249

Warning: Invalid argument supplied for foreach() in /usr/share/php/PEAR/Command.php on line 249

Warning: Invalid argument supplied for foreach() in PEAR/Command.php on line 249

Warning: Invalid argument supplied for foreach() in /usr/share/php/PEAR/Command.php on line 249

Warning: Invalid argument supplied for foreach() in PEAR/Command.php on line 249

Warning: Invalid argument supplied for foreach() in /usr/share/php/PEAR/Command.php on line 249

Warning: Invalid argument supplied for foreach() in PEAR/Command.php on line 249

Warning: Invalid argument supplied for foreach() in /usr/share/php/PEAR/Command.php on line 249

Warning: Invalid argument supplied for foreach() in PEAR/Command.php on line 249

Warning: Invalid argument supplied for foreach() in /usr/share/php/PEAR/Command.php on line 249

Warning: Invalid argument supplied for foreach() in PEAR/Command.php on line 249

Warning: Invalid argument supplied for foreach() in /usr/share/php/PEAR/Command.php on line 249

Warning: Invalid argument supplied for foreach() in PEAR/Command.php on line 249

Warning: Invalid argument supplied for foreach() in /usr/share/php/PEAR/Command.php on line 249

Warning: Invalid argument supplied for foreach() in PEAR/Command.php on line 249

Warning: Invalid argument supplied for foreach() in /usr/share/php/PEAR/Command.php on line 249

Warning: Invalid argument supplied for foreach() in PEAR/Command.php on line 249

Warning: Invalid argument supplied for foreach() in /usr/share/php/PEAR/Command.php on line 249

Warning: Invalid argument supplied for foreach() in PEAR/Command.php on line 249

Warning: Invalid argument supplied for foreach() in /usr/share/php/PEAR/Command.php on line 249

Warning: Invalid argument supplied for foreach() in PEAR/Command.php on line 249

Warning: Invalid argument supplied for foreach() in /usr/share/php/PEAR/Command.php on line 249
XML Extension not found

Last line gives me this message

XML Extension not found

, although I installed #sudo apt-get install php-xml php7.0-xml. But the same problem still occurs.

What could be the problem?


回答1:


On some installations, there is a bug in pecl. Find this line;

exec $PHP -C -n -q $INCARG -d date.timezone=UTC -d output_buffering=1 -d variables_order=EGPCS -d safe_mode=0 -d register_argc_argv="On" $INCDIR/peclcmd.php "$@" 

remove the -n

If you want to script it, try:

sed -i "$ s|\-n||g" /usr/bin/pecl



回答2:


Install this list and everything will work fine :)

sudo apt-get install php-pear pkg-config libbson-1.0 libmongoc-1.0-0 php-xml php7.0-xml php-dev



回答3:


Was Facing this issue, i just needed to install php-xml

sudo apt-get install php-xml

Credits: Taha EL BOUFFI

Full Explanation as to why can be found here



来源:https://stackoverflow.com/questions/40999752/pear-error-xml-extension-not-found-on-ubuntu-14-04-after-installing-php-xml

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!