Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 426
Towen Avatar asked Dec 06 '16 16:12

Towen


2 Answers

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

like image 79
Angad Arora Avatar answered Oct 27 '22 22:10

Angad Arora


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
like image 27
richp10 Avatar answered Oct 27 '22 22:10

richp10