GD, Apache, Captcha, PHP, Error

I had to setup a captcha on someone’s website. The captcha refused to load. The easiest way to get the error (since, by default, PHP will not list out all the problems when called from another page) is to call the script directly.
Say your site is http://www.mysite.net. You’ll want to go to http://www.mysite.net/CaptchaSecurityImages.php. You can do the website math.

I had apache installed, GD installed, PHP installed.

This is the error I was receiving:
Warning: imagettfbbox() [function.imagettfbbox]: Could not find/open font in /var/www/sitehere/CaptchaSecurityImages.php on line 60

Error in imagettfbbox function, eh? That’s none too helpful. Good thing I can read: Could not find/open font. That’s all I need to know.

If you were to open up CaptchaSecurityImages.php and change the location of monofont.ttf to a debian/ubuntu file location, everything would probably end up working correctly.

SSH to your machine
nano CaptchaSecurityImages.php
Search for:
var $font = 'monofont.ttf'
and replace with:
var $font = './monofont.ttf'
Reload your script on your web browser

One thought on “GD, Apache, Captcha, PHP, Error”

Leave a Reply

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