If you get an Invalid License File error when you login to cPanel after a hostname change, you will need to update your cPanel license file by doing the following. Please note that you will need to have Root SSH Direct Access in advance as it can only be turned on from WHM and this will be impossible once you are locked out.
(1) Login to shell and
(2) Execute /usr/local/cpanel/cpkeyclt from command line.
Your issue should now be resolved. If you are still having problems. you may want to contact your host for assistance.