Symptoms
Attempting to set the PHP handler in WHM via MultiPHP Manager returns the below error:
The supplied domain name is invalid. [php_set_handler]
The error can also be received when running cPanel updates or changing the handler manually in SSH/CLI.
whmapi1 php_set_handler version='ea-php74' handler='lsapi'
---
metadata:
command: php_set_handler
reason: "API failure: (XID afv893) The supplied domain name is invalid."
result: 0
version: 1
Description
If multiple users partially own the same domain name, it will cause issues changing PHP versions or handlers. This error is commonly caused by multiple users owning a specific file on the system at path "/etc/valiases/
". Correcting the ownerships of the related file will resolve the issue. We've observed that these issues occur when swapping domains around between accounts where an operation may have failed or was performed incorrectly.
Workaround
Fix ownership of the "valiases" file. You can accomplish the task in two ways. The easy way is the preferred way as no additional troubleshooting is required. Run the script below.
/scripts/mailperm
If this resolved the issue, you are all set. However, if the problem still exists, the below troubleshooting steps will help.
Note: Only proceed with the below steps if the mailperm script didn't resolve the issue.
Finding which files to fix is difficult, but the below steps will allow you to isolate which domain(s) are causing the issue. A few troubleshooting steps are required to identify which domains experience this problem.
1. Run the yum update script to receive errors:
/etc/yum/universal-hooks/multi_pkgs/posttrans/__WILDCARD__-php__WILDCARD__/009-phpconf.pl
Note: This post transaction YUM update script is normally performed after system updates are applied in EasyApache/PHP. An error is returned if a problem exists with any particular domain.
An error would look like the below output:
Cpanel::WebServer::Userdata::get_vhost_lang_package
(Cpanel::WebServer::Userdata=HASH(0x2daaef8), "lang",
Cpanel::ProgLang::Supported::php=HASH(0x1cc10f0), "vhost", "cPtestdomain.tld")
called at /usr/local/cpanel/Cpanel/WebServer/Supported/apache.pm line 778
Try::Tiny::try(CODE(0x2da9c58), Try::Tiny::Catch=REF(0x2d4b418))
called at /usr/local/cpanel/Cpanel/WebServer/Supported/apache.pm line 788
2. In the received errors, it contained a domain that causes the problem. The example domain is "cPtestdomain.tld".
3. Confirm the ownerships of the valiases file for "cPtestdomain.tld".
stat /etc/valiases/cPtestdomain.tld
File: ‘/etc/valiases/cPtestdomain.tld’
Size: 28 Blocks: 8 IO Block: 4096 regular file
Device: 802h/2050d Inode: 2895448 Links: 1
Access: (0640/-rw-r-----) Uid: ( 1006/cPuser1) Gid: ( 12/ mail)
Access: 2019-08-18 20:08:08.954129642 -0300
Modify: 2019-01-29 18:45:41.973270387 -0300
Change: 2019-01-29 18:45:41.973270387 -0300
Birth: -
Note: In the above snippet, user "cPuser1" is not the correct account that owns the domain. The user "cPuser2" actually owns the account because it was changed to another account.
4. Use the chown command to set the correct user.
chown cPuser2.mail /etc/valiases/cPtestdomain.tld
You should be all set. If issues do continue, please open a support ticket.