Skip to content
Dynamic DNS Zone Updater for WHM/cPanel
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
server Specified WHM API Version 1 and added better API response handling. Jun 11, 2018
class.ZoneUpdater.php Specified WHM API Version 1 and added better API response handling. Jun 11, 2018


What is whmDynDns?

whmDynDns is a PHP script which takes advantage of the WHM JSON API in order to update DNS zone
records for pointing subdomains to a server with a dynamic IP address. It can be run using CRON and
based on your configuration will add/update A records when your public IP address changes.

Why was it created?

Although I have my production websites hosted remotely I wanted to be able to point development
versions to my own server hosted at home with a dynamic IP address. i.e.
is hosted remotely but is hosted locally on my own machine. After a little searching
I found the WHM JSON API and had to have some fun with it!

How to use whmDynDns?

Copy the whmDynDns.config.sample.php to whmDynDns.config.php and configure the following options:

// Set Log Level (0 = errors only, 1 = IP changes only, 2 = Everything)
const LOG_LEVEL =  1;

// Set your TimeZone

Set this to your WHM Admin login
$username = 'YourUsername';

Set this to your WHM Admin password
$password = 'YourPassword';

Set this to your WHM Login URL (2087 is the default WHM SSL port)
$whmUrl = '';

Add one more more websites to scrape our IP from (one or more as array)
Included in the "server" folder is very simple PHP script you can upload
to a external server to get your remote IP.

$websites[] = '';
$websites[] = '';

Add your host names here (one or more as array).
'name' is the subdomain, if left empty, it will add/update a record for the root domain itself (ex,
'zone' is the domain
'ttl' is the time to live of the record, if left empty, iit will be set as the DNS server default
$zones[] = array('name' => 'sub1', 'zone' => '');
$zones[] = array('name' => 'sub2', 'zone' => '', 'ttl' => 900);
$zones[] = array('name' => '', 'zone' => '');

Schedule with CRON

Setup whmDynDns.php to run at regular intervals using CRON (via 'crontab -e', etc.) and pipe to log!

i.e. Every fifteen minutes would look like:

*/15     *     *     *     *     php /home/phpguy/cron/whmDynDns.php >> /var/log/whmDynDns.log
You can’t perform that action at this time.