Frequently Asked Questions

Even if I type the correct code, ArCaptcha always says it is wrong.

  1. The first line in the form processor must be:
    1 <?php session_start(); ?>
    If there's any HTML code or whitespace before starting the PHP session, then the validation will always fail.

  2. Cookies must be enabled in the client browser, otherwise, the validation will always fail.

  3. Make sure that the the verify code inpute tag's name attribute is the same as the one you check in the form processing. If your form uses:
    1 <input type="text" name="captcha_code" />
    Then, the form processor reference must be: $_POST['captcha_code'] when calling the function

  4. If the variable names are the same, then the probelm might be with the PHP session which is being used to save the verify code. It's possible that the session is not started yet, or the used session name in GetArCaptcha.php file is differs from the session name in the script that does the code validation. It's common that some software platforms (such as forums, content management systems, form processors and frameworks like Yii) to use a session name other than the PHP default. If this is the case, you must determine what session name is used by the software and use the same session name in GetArCaptcha.php file.

    You can pass a custom session name to ArCaptcha, so, you can share the same session name with any other software platform, to set the custom session name, un-comment the following line in GetArCaptcha.php file and replace the value of the varialble with your session name:
    1 $img->session_name = 'session_name';
    Note: ArCaptcha will NEVER destroy a session so it is safe to use with systems that persist user data with sessions; it only changes its own session variables.

I get an error that says “Call to undefined function imagecreatetruecolor()” in ArCaptcha.php

If this error appears it means PHP does not have GD support which is required for creating images with PHP. Unfortunately, if you get this error ArCaptcha will not work.
GD has been included with PHP since version 4.3 but some older PHP installations do not support it. You will need to contact your webhost to request GD support, or recompile PHP with GD support if you are running ArCaptcha on your own server.

See the Installing/Configuring GD page on for more information.

I get an error that says “Call to undefined function imagettftext()” in ArCaptcha.php

This error means that your version of PHP does not have FreeType support built in. FreeType must be installed in order to use TTF fonts.

The image appears but there is no text on the image

There is a known bug in PHP 5.3.2 that can cause this problem intermittently. If you are using PHP 5.3.2, you may need to upgrade to a newer version.
In case the image appeared without the verify code on it, it means that the font file path is incorrect or not accessable. When using a custom font, it's recommended to use the absolute path of the font file, if you are not sure about the full path, you can use:
1 $img->font_file = $_SERVER['DOCUMENT_ROOT'] . '/fonts/font.ttf';
as an example, and of course you need to change the folder and file name as you placed it.

Verify code appears as rectangles

This means one of two, either the font you are using does not support Arabic, or you are using a fixed verify code in English and the font does not support it.

The image does not show up on my HTML page

Make sure that the URL specified in the HTML img tag points to the proper location of GetArCaptcha.php. To be sure you can use the full address (i.e.
To verify that another problem doesn't exist, try viewing the image directly in your browser by going to GetArCaptcha.php in your browser.

No image appears and nothing shows up when I go to GetArCaptcha.php URL

A fatal PHP error may have occurred that is preventing the image from displaying and the PHP configuration is not set to show error messages.
To enable error display in PHP, un-comment the following line in GetArCaptcha.php file:
1 error_reporting(E_ALL); ini_set('display_errors', 1);
After saving the file, go to GetArCaptcha.php URL in your browser to see if any errors are displayed that can help in determining why the image is not showing.

I get an error that says “Warning: include(ArCaptcha.php) [function.include]: failed to open stream: No such file…”

This error means that the path to ArCaptcha.php passed to the include statement is not correct. In this case, you will need to fix the file path to point to the correct location. The paths vary between servers and configurations. Use the absolute path, since that:
1 include_once '/ArCaptcha/ArCaptcha.php';
will not be correct in most cases, use:
1 include_once $_SERVER['DOCUMENT_ROOT'] . '/ArCaptcha/ArCaptcha.php';
if you placed the ArCaptcha folder under the root of the web directory directly.
× For a better experience with the website, we recommend you to use Google Chrome or Mozilla Firefox browsers