Usually, you would check the Activity Log or the System Module Debug Log. But what happens if the Admin Area is inaccessible because of the license error itself? You end up in a loop where you can't debug the error because the error blocks the debugger.
Fortunately, since we have access to the file system, we can bypass the UI and ask WHMCS directly what is going on under the hood. There is a neat "life hack" involving a simple PHP script that forces a license check and dumps the raw debug log directly to your browser or command line.
The Solution
To get the detailed error log, we need to manually invoke the \WHMCS\License class and output its internal log. This reveals communication issues, IP mismatches, or curl errors that the GUI hides from you.
Create a file named debug_license.php in the root directory of your WHMCS installation (where your init.php is located) and paste the following code:
'; // Attempt to validate the license var_dump($licensing->validate()); echo "\r\n"; // Output the raw debug log var_dump($licensing->getDebugLog()); echo '';
How to run it
You can execute this script in two ways:
- Via Browser: Navigate to
https://your-whmcs-domain.com/debug_license.php - Via CLI: Run
php debug_license.phpin your terminal.
The output will show you the boolean result of the validation (true/false) followed by an array or string containing the raw communication data with the WHMCS licensing servers. Look closely for "Connection refused," "IP Mismatch," or local DNS resolution errors.
Security Warning: Do not forget to delete this file immediately after you have identified the issue. Leaving debug scripts accessible to the public is a security risk.
If you need high-quality code refactoring, migration of legacy code to modern standards, or custom development from scratch, feel free to contact me via the form at https://gaalferov.com/kontaktnaya-informaciya.html or drop me an email. I provide development services for WHMCS, Laravel, and Symfony, as well as custom-built systems.
