Symptoms
When trying to change the System's default PHP version from the WHM >> Software >> PHP Manager >> PHP Versions >> System PHP Version interface, you are presented with this error:
Error: API failure: Can't call method "get_default_string" on an undefined value at /usr/local/cpanel/Cpanel/WebServer/Supported/apache.pm line 367
Alternatively, you might be presented with this error when trying to check the current EasyApache's PHP configuration:
/usr/local/cpanel/bin/rebuild_phpconf --current
DEFAULT PHP: ea-php73
ea-php73 SAPI: cgi
Cpanel::Exception::MissingParameter/(XID sv7d8q) Provide the “type” parameter for the “Cpanel::WebServer::Supported::apache::make_handler” function.
at /usr/local/cpanel/Cpanel/WebServer/Supported/apache.pm line 223.
Cpanel::WebServer::Supported::apache::make_handler(Cpanel::WebServer::Supported::apache=HASH(0x22ceae8), "lang", Cpanel::ProgLang::Supported::php=HASH(0x200b250), "package", "ea-php74", "type", undef) called at /usr/local/cpanel/bin/rebuild_phpconf line 194
bin::rebuild_phpconf::ea4::do_current(HASH(0x1f77338), Cpanel::ProgLang::Supported::php=HASH(0x200b250), Cpanel::WebServer::Supported::apache=HASH(0x22ceae8)) called at /usr/local/cpanel/bin/rebuild_phpconf line 226
bin::rebuild_phpconf::ea4::run(ARRAY(0x1a33f20)) called at /usr/local/cpanel/bin/rebuild_phpconf line 246
Description
The issue is that the plugins value is missing from the yum.conf file, which is known to cause EA4 rpm failures. You can confirm this by running this command: (This should return either no output or lines that are commented out)
grep plugins /etc/yum.conf
Workaround
First, the plugins value must be added to yum.con:
echo "plugins=1" >> /etc/yum.conf
Then you need to reinstall the PHP version you intend to use for the system's default PHP via this command: (Here ## represents the version number like 74, 56, ..)
yum reinstall ea-php##*
The above command should also automatically rebuild EasyApache's PHP configuration and restart EA-related services (httpd.service,apache_php_fpm.service,..). However, you can always check to see if EasyApache's PHP configuration has indeed been successfully rebuilt by running this command:
/usr/local/cpanel/bin/rebuild_phpconf --current
DEFAULT PHP: ea-php73
ea-php73 SAPI: cgi
ea-php74 SAPI: cgi