Symptoms
Attempting to set the PHP handler in WHM via MultiPHP Manager returns the below error:
CONFIG_TEXT: 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
Cause
If multiple users partially own the same domain name, it will cause issues when changing PHP versions or handlers via the MultiPHP Manager. This error is commonly caused by multiple users owning a specific file on the system within /etc/valiases/. Correcting the ownership 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.
Resolution
Running the following command should resolve the issue in most cases:
# /scripts/mailperm
If the mailperm script does not resolve the issue, identifying which file(s) to fix is difficult, but the steps below will help you isolate which domain(s) is causing the issue.
- Access the server's command line as the 'root' user via SSH or Terminal in WHM.
Run one of the the following scripts depending on your server's operating system:
CentOS 7, CouldLinux 7, and CloudLinux 6# /etc/yum/universal-hooks/multi_pkgs/posttrans/__WILDCARD__-php__WILDCARD__/009-phpconf.pl
AlmaLinux 8 & CloudLinux 8# /etc/dnf/universal-hooks/multi_pkgs/transaction/__WILDCARD__-php__WILDCARD__/009-phpconf.pl
Ubuntu 20.04# /etc/apt/universal-hooks/multi_pkgs/Post-Invoke/__WILDCARD__-php__WILDCARD__/009-phpconf.pl
If a problem exists with a domain, output similar to the following is returned:
CONFIG_TEXT: Cpanel::WebServer::Userdata::get_vhost_lang_package
(Cpanel::WebServer::Userdata=HASH(0x2daaef8), "lang",
Cpanel::ProgLang::Supported::php=HASH(0x1cc10f0), "vhost", "domain.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 788Copy the problematic domain name from the output of the previous script.
Note: The problematic domain in the above output is the example domain.tld.
Confirm the ownership of the valiases file for that domain:
# stat /etc/valiases/domain.tld
File: /etc/valiases/domain.tld
Size: 28 Blocks: 8 IO Block: 4096 regular file
Device: 802h/2050d Inode: 2895448 Links: 1
Access: (0640/-rw-r-----) Uid: ( 1006/wrongusername) 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 output, the user "wrongusername" is not the correct owner of the domain. The correct owner of the domain in this example is "rightusername."
Use the
chowncommand to set the correct user:# chown -v rightusername.mail /etc/valiases/domain.tld
Comments
0 comments
Article is closed for comments.