PHP Captcha Security Images Help

Firstly make sure you are using the latest version of the captcha script available on http://www.white-hat-web-design.co.uk/blog/php-captcha-security-images/

Check you have the required GD & FreeType libraries. This can be done by putting the following in a new file and checking the output mentions GD & FreeType

1
2
3
<?php
phpinfo();
?>

Perl Formmail

Unfortunately this script cannot be used alongside Perl formmail scripts, you will need to find one written in PHP

Image Not Showing

You can also see if there is an error message produced by adding the line error_reporting(E_ALL); above session_start(); in CaptchaSecurityImages.php then go to CaptchaSecurityImages.php in your browser

If you get the error Warning: imagettfbbox() [function.imagettfbbox]: Could not find/open font in … then try the following

Ensure you have uploaded the monofont.ttf file into the same directory as CaptchaSecurityImages.php. Add the line

1
2
3
<?php
putenv('GDFONTPATH='.realpath('.')); 
?>

to the top of the CaptchaSecurityImages.php file, above session_start();

Also try changing the line

1
2
3
<?php 
var $font = 'monofont.ttf';
?>

to

1
2
3
<?php
var $font = 'monofont'; 
?>

Alternatively try setting the font variable as a full path to the font on your server, e.g

1
2
3
<?php
var $font = '/home/user/public_html/monofont.ttf';
?>

Still Having Problems?

If you are still having problems using this script please email us, we can’t guarantee we’ll get back to you straight away, but we’ll try our best.

You can help us identify the problem quicker if you provide the following details shown in the phpinfo() output:

  • Information on PHP version
  • Configure Command
  • Information from the GD & FreeType sections

If you find this script useful then please consider making a donation to the developer

Posted by admin on Saturday, September 29th, 2007