WHMCS (Curl Error) couldn’t connect to host – code: 7

We have recently faced an issue with setting up an additional server for WHMCS. We have servers from wiredtree (those buys are amazing, outstanding support!), but nobody could help us. Also, if you google this problem there are not really any good advice about this issue. After 12h of testing many options and searching for the solution – we found it, and now we share it.

Module Command Error
(Curl Error) couldn’t connect to host – code: 7

On the official WHMCS site you can find:

Server Command Error – Curl Error – Couldn’t connect to host (7)
This response means you have a firewall blocking the connection. The port being used depends on what module you are using but for cPanel it would be 2086/2087, Plesk 8443, DirectAdmin 2222, etc…

Indeed they are correct :)

So, we had 2 servers, one of them had installed WHMCS (let’s call it Server A) and we wanted to attach another VPS server (let’s call it Server B) to this WHMCS. Here are potential issues:

1. You must whilelist IP of server B in WHM of the server B. Simply go to WHM of the server B to a section Plugins > ‘ConfigServer Security&Firewall’, then whilelist there an IP of the server A. Here is one problem – you may not have ‘ConfigServer Security&Firewall’ plugin installed (we had that issue). So, just ask your hosting provider to install csf plugin for you, guys from wiredtree did it for us! :)

2. When adding a new server to WHMCS insert Access Hash, which you can generate in WHM of server B (Setup Remote Access Key).

3. As we found it online, it is good if server B has a root password without special characters – that may cause some issues.

Hopefully that save somebody few hours of problems :)