This might be the most specific technical blog post I ever write about, but after searching for a result on Stack Overflow for the better part of an hour and speaking with Tech Support from a managed host I was working with, I feel that it’s worth sharing. It will also give me a reference point further down the line.

Specific scenario: on a custom WordPress form, a PHP external API call (to a subdomain of the current domain) is made to validate a field, but the domain returns unresolved causing the validation to fail. Only the website is hosted on this server, meaning the name server and DNS records for the domain reside somewhere else.

The end result here is that for any subdomains that are called in a server-side application, CPanel will default to its own DNS entries for the domain regardless of where the domain’s actual DNS records live. The same would not be the case if the call was made client side.

To fix this situation, you need to create a custom DNS record that is a duplicate of the one on the name server. That way when the PHP call incorrectly refers to CPanel’s own DNS records, it receives the right value of the DNS record and completes the API call out.

Why This Fix Causes Problems

Anytime you have to duplicate DNS records or any type of similar data you are running into a sustainability nightmare. In 5 years when that record changes on the name server, it won’t be replicated on the CPanel DNS entry you have duplicated to make it work, leading to a broken application.

Unfortunately there is no other work around for the time being.