Error in PECL for PHP 7.0 under CentOS 7

Kent Brockman

Well-Known Member
PartnerNOC
Jan 20, 2008
1,255
60
178
Buenos Aires, Argentina
cPanel Access Level
Root Administrator
Hello guys, I noticed this issue in two servers already:
I use to enable PECL APCu on servers with PHP 7.0/7.1. This worked perfect on all my CentOS 6.9 servers.

But when it comes to install APCu for PHP 7.0 on CentOS 7.3, I got this shown in screen:
(notice: this does not happen on PECL for PHP 7.1, even if both have the same active modules, so it must be a bug)

Code:
Path Warning: Invalid argument supplied for foreach() in Command.php on line 249 Warning: Invalid argument supplied for foreach() in /opt/cpanel/ea-php70/root/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 /opt/cpanel/ea-php70/root/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 /opt/cpanel/ea-php70/root/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 /opt/cpanel/ea-php70/root/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 /opt/cpanel/ea-php70/root/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 /opt/cpanel/ea-php70/root/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 /opt/cpanel/ea-php70/root/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 /opt/cpanel/ea-php70/root/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 /opt/cpanel/ea-php70/root/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 /opt/cpanel/ea-php70/root/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 /opt/cpanel/ea-php70/root/usr/share/pear/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 /opt/cpanel/ea-php70/root/usr/share/pear/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 /opt/cpanel/ea-php70/root/usr/share/pear/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 /opt/cpanel/ea-php70/root/usr/share/pear/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 /opt/cpanel/ea-php70/root/usr/share/pear/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 /opt/cpanel/ea-php70/root/usr/share/pear/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 /opt/cpanel/ea-php70/root/usr/share/pear/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 /opt/cpanel/ea-php70/root/usr/share/pear/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 /opt/cpanel/ea-php70/root/usr/share/pear/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 /opt/cpanel/ea-php70/root/usr/share/pear/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 /opt/cpanel/ea-php70/root/usr/share/pear/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 /opt/cpanel/ea-php70/root/usr/share/pear/PEAR/Command.php on line 249 XML Extension not found

Any ideas on why this may be happenning?
Thanks in advance!
 

Attachments

24x7server

Well-Known Member
Apr 17, 2013
1,911
96
78
India
cPanel Access Level
Root Administrator
Twitter
Hi,

The error you gave has something in the last that states : XML Extension not found. Can you confirm this module is installed on the PHP 7 of your installation?

Have you tried something like below on your server?

# pecl install apcu-(Version)
 

Kent Brockman

Well-Known Member
PartnerNOC
Jan 20, 2008
1,255
60
178
Buenos Aires, Argentina
cPanel Access Level
Root Administrator
Yep, XML is installed already.

Have you tried something like below on your server?
# pecl install apcu-(Version)
I wouldn't try that, as cPanel is now able to install PECL items for specific, available PHP versions installed. I'm not sure if this is something you can install globally without doing a mess.
 

Attachments

Last edited by a moderator:

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,205
363
Hello,

Can you reproduce the issue when installing that PECL module via the command line for PHP 7.0? EX:

Code:
/opt/cpanel/ea-php70/root/usr/bin/pecl install apcu
Also, please post the output from the following command:

Code:
rpm -qa|grep php-xml
Thank you.
 

Kent Brockman

Well-Known Member
PartnerNOC
Jan 20, 2008
1,255
60
178
Buenos Aires, Argentina
cPanel Access Level
Root Administrator
Hello,

Can you reproduce the issue when installing that PECL module via the command line for PHP 7.0? EX:

Code:
/opt/cpanel/ea-php70/root/usr/bin/pecl install apcu
Hello Michael, the problem is when you try to install acpu using the WHM UI. I tried from the command line for PHP 7.1 and worked like a breeze:
Code:
/opt/cpanel/ea-php71/root/usr/bin/pecl install apcu
This worked ok on CentOS 6.9!


And the one below worked ok on CentOS 7.3!
Code:
/opt/cpanel/ea-php70/root/usr/bin/pecl install apcu

Also, please post the output from the following command:
Code:
rpm -qa|grep php-xml
This is the output on CentOS 7.3:
Code:
rpm -qa|grep php-xml
ea-php55-php-xmlrpc-5.5.38-22.22.5.cpanel.x86_64
ea-php71-php-xml-7.1.7-1.1.6.cpanel.x86_64
ea-php56-php-xml-5.6.31-1.1.6.cpanel.x86_64
ea-php56-php-xmlrpc-5.6.31-1.1.6.cpanel.x86_64
ea-php55-php-xml-5.5.38-22.22.5.cpanel.x86_64
ea-php70-php-xml-7.0.21-1.1.6.cpanel.x86_64
ea-php54-php-xml-5.4.45-38.38.5.cpanel.x86_64
ea-php71-php-xmlrpc-7.1.7-1.1.6.cpanel.x86_64
ea-php54-php-xmlrpc-5.4.45-38.38.5.cpanel.x86_64
ea-php70-php-xmlrpc-7.0.21-1.1.6.cpanel.x86_64
and this one is the output in my CentOS 6.9:
Code:
rpm -qa|grep php-xml
ea-php70-php-xml-7.0.21-1.1.6.cpanel.x86_64
ea-php55-php-xmlrpc-5.5.38-22.22.5.cpanel.x86_64
ea-php71-php-xml-7.1.7-1.1.6.cpanel.x86_64
ea-php54-php-xml-5.4.45-38.38.5.cpanel.x86_64
ea-php55-php-xml-5.5.38-22.22.5.cpanel.x86_64
ea-php70-php-xmlrpc-7.0.21-1.1.6.cpanel.x86_64
ea-php56-php-xml-5.6.31-1.1.6.cpanel.x86_64
ea-php54-php-xmlrpc-5.4.45-38.38.5.cpanel.x86_64
ea-php71-php-xmlrpc-7.1.7-1.1.6.cpanel.x86_64
ea-php56-php-xmlrpc-5.6.31-1.1.6.cpanel.x86_64
Do you see anything odd?
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,205
363
Hello,

The output you provided looks normal, and I'm unable to reproduce this issue on a test system. Could you open a support ticket using the link in my signature so we can take a closer look?

Thank you.
 

petersphilo

Member
Nov 14, 2016
22
6
3
Paris
cPanel Access Level
Reseller Owner
Hello, i ran into the same issue and found a solution..
Backround:
i have 3 versions of php installed: 5.6, 7.0 and 7.1
in WHM->Module Installers->PHP PECL
the installer worked fine for 7.0 (didn't check 5.6), but not 7.1; it would display an entire page filled with error messages like this:
Warning: Invalid argument supplied for foreach() in Command.php on line 249 Warning: Invalid argument supplied for foreach() in /opt/cpanel/ea-php71/root/usr/share/pear/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:.....
and at the very end was this mention:
XML Extension not found
so i found this solution on serverfault
Basically, the installer is using the -n option, which disregards any custom .ini files and, as such, ignores the xml extension, which it needs in order to function properly

except, instead of simply executing nano `which pear` to remove the -n option, you have to modify a version appropriate file.
in the case of php 7.1, it is as follows:
Code:
nano /opt/cpanel/ea-php71/root/usr/bin/pecl
Interestingly, the contents of /opt/cpanel/ea-php71/root/usr/bin/pecl and /opt/cpanel/ea-php70/root/usr/bin/pecl are quite different..

here is /opt/cpanel/ea-php71/root/usr/bin/pecl -- note the -n option at the beginning of the last line
Code:
#!/bin/sh

# first find which PHP binary to use
if test "x$PHP_PEAR_PHP_BIN" != "x"; then
  PHP="$PHP_PEAR_PHP_BIN"
else
  if test "/opt/cpanel/ea-php71/root/usr/bin/php" = '@'php_bin'@'; then
    PHP=php
  else
    PHP="/opt/cpanel/ea-php71/root/usr/bin/php"
  fi
fi

# then look for the right pear include dir
if test "x$PHP_PEAR_INSTALL_DIR" != "x"; then
  INCDIR=$PHP_PEAR_INSTALL_DIR
  INCARG="-d include_path=$PHP_PEAR_INSTALL_DIR"
else
  if test "/opt/cpanel/ea-php71/root/usr/share/pear" = '@'php_dir'@'; then
    INCDIR=`dirname $0`
    INCARG=""
  else
    INCDIR="/opt/cpanel/ea-php71/root/usr/share/pear"
    INCARG="-d include_path=/opt/cpanel/ea-php71/root/usr/share/pear"
  fi
fi

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 "[email protected]"
and here is /opt/cpanel/ea-php70/root/usr/bin/pecl
Code:
#!/bin/sh
exec /opt/cpanel/ea-php70/root/usr/bin/php -C \
    -d include_path=/opt/cpanel/ea-php70/root/usr/share/pear \
    -d date.timezone=UTC \
    -d output_buffering=1 \
    -d variables_order=EGPCS \
    -d safe_mode=0 \
    -d register_argc_argv="On" \
    /opt/cpanel/ea-php70/root/usr/share/pear/peclcmd.php "[email protected]"
EDIT: the php56 file looks much like the php70 file, and is confirmed working on my system.
Finally, i'll note that php71 is my default php version -- not sure whether that makes a difference here.
Clearly, though, when i installed php71 through EasyApache 4, the default Pecl script was used, rather than the custom one used by php56 and php70....
 
Last edited:

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,205
363
the installer worked fine for 7.0 (didn't check 5.6), but not 7.1;
Can you verify which version of cPanel is installed on this system? Also, are you using the latest available packages offered in the EA4 yum repo (E.g. running "yum update" shows no available updates)?

Thank you.
 

petersphilo

Member
Nov 14, 2016
22
6
3
Paris
cPanel Access Level
Reseller Owner
@cPanelMichael: WHM is v66.0.19, and 'yum update' results in 'No packages marked for update'...
Also, i just migrated my server from EA3 to EA4 and, once that was done, from php54 + php55 + php56 to php56 + php70 + php71 last week; i made php71 the default and enabled php-fpm

Note: the above solution worked perfectly