How to FIx Error: Call to undefined method WHMCS\Utility\Captcha\LocalImage::getSiteKey()

Error: Call to undefined method WHMCS\Utility\Captcha\LocalImage::getSiteKey() in /home/ajkhostsite/public_html/templates_c/32e7e70dbe2996d1ae34daa3036ca9c72402fc5c_0.file.head.tpl.php:78 Stack trace:

If you encounter the following error in WHMCS In today’s article, we will tell you how to completely solve this problem:

Error Details:
Error: Call to undefined method WHMCS\Utility\Captcha\LocalImage::getSiteKey() in /home/ajkhostsite/public_html/templates_c/32e7e70dbe2996d1ae34daa3036ca9c72402fc5c_0.file.head.tpl.php:78
Stack trace:

This means you are trying to use a WHMCS installation method (getkey()) that does not exist in the local image class used for the captcha.

I will tell you three or four ways to solve this problem but the first method I am going to tell you will solve your problem.Why does this problem occur? This problem often occurs when you use a custom theme or install it on your system after purchasing it from somewhere else.The theme that you have installed does not support the function of WHMCS, which is its own capture, but rather it supports Google ReCapture or some other Recapture, so you have to check this first. After checking this, I am sure that you will get the problem fixed.

Check Your Captcha Settings

Log in to your WHMCS Admin Panel.

Go to: Setup > General Settings > Security : After coming here, from the box that appears, you have to select Google ReCapture

And then go to this website https://www.google.com/recaptcha/admin. After coming to this website, you have to create an account.

From here you have to copy that secret key and paste it here in your WHMCS, after that your problem will be solved.

Using this method, you can solve your problem, but you have to check which reCAPTCHA your theme supports. You can also check which reCAPTCHA it supports by reading the documentation of your theme.

🚫 IMPORTANT WARNING: When selecting Recapture, never tick the login form unless you have set it up properly. If you make a mistake or enter your reCAPTCHA Secret Key incorrectly, you will not be able to log in to your admin panel and this will create a new problem for you. You need to remember this.

Still Not Fixed?

  • Switch to a WHMCS default theme like Six or Twenty-One to test.
  • Make sure your template is compatible with your WHMCS version.
  • Contact WHMCS support or your developer for assistance.

You can also use the methods given below if you need our help. Our WhatsApp number is +923461185875

Root Cause

This error typically occurs due to one of the following reasons:

You are using a WHMCS template or custom code that references getSiteKey() regardless of the captcha type.

WHMCS is set to use Default Image Captcha (LocalImage), but your template assumes Google reCAPTCHA, which uses getSiteKey().

How to Fix the Error

🔧 Step 1: Clear the templates_c Folder

Go to your WHMCS installation via File Manager or FTP.

Navigate to: public_html/templates_c/

Delete all .php and .tpl.php files inside this folder. (Do not delete the folder itself.)

These will be automatically recompiled by WHMCS.

🔧 Step 2: Check Your Captcha Settings

Log in to your WHMCS Admin Panel.

Go to: Setup > General Settings > Security

Check the Captcha Form Protection settings:

If you are using Default (Image Verification), the getSiteKey() function is not needed.

If you want to use Google reCAPTCHA, make sure you’ve selected it and provided a valid Site Key and Secret Key.

🔧 Step 3: Update the Template File

If you’re using a custom template, it might be calling $captcha->getSiteKey() even when not using Google reCAPTCHA.

Look for this line in files like head.tpl:

phpCopyEdit{$captcha->getSiteKey()}

Update it to only call getSiteKey() if the captcha type is reCAPTCHA:

smartyCopyEdit{if $captcha->getName() == "recaptcha"}
    {$captcha->getSiteKey()}
{/if}

This will prevent the error when using LocalImage.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top