I recently upgraded my web servers in an effort to increase website speed. As with all of our web servers, the newly installed servers are loaded with Debian GNU/Linux and then Virtualmin.

Specifically, our new systems are running:

  • Kernel and CPU: Linux 2.6.26-2-686-bigmem on i686
  • Operating system: Debian Linux 5.0
  • Apache version: 2.2.9
  • BIND version: 9.6
  • ClamAV version: 0.96.1
  • Logrotate version: 3.7.1
  • MySQL version: 5.0.51
  • Perl version: 5.010000
  • PHP version: 5.2.6
  • Postfix version: 2.5.5
  • ProFTPd version: 1.31
  • SpamAssasssin version: 3.2.5
  • Webalizer version: 2.01-10

Using Virtualmin gives all our clients instant ability to install other packages (or scripts), immediately adding additional functionality. One such package is WordPress. WordPress is a state-of-the-art publishing platform with a focus on aesthetics, web standards, and usability. Part of the “USABILITY” comes in the form of Plugins. WordPress my have an infinite number of plugins but this error showed up when using CAPTCHA technology to secure a WordPress Site.

A CAPTCHA is a type of challenge-response test used in computing to ensure that the response is not generated by a computer. The process usually involves one computer (a server) asking a user to complete a simple test which the computer is able to generate and grade. CAPTCHAs are used to prevent automated software from performing actions which degrade the quality of service of a given system, whether due to abuse or resource expenditure. CAPTCHAs can be deployed to protect systems vulnerable to e-mail spam, such as the webmail services of Gmail, Hotmail, and Yahoo! Mail.

CAPTCHA web utilities are usually coded in PHP for use on web sites. Most will allow JPEG, GIF, PNG, SWF, TIFF and JPEG2000 images types to be used. For a CAPTCHA to work, You will need to compile PHP with the GD library of image functions. GD and PHP may also require other libraries, depending on which image formats you want to work with.

When installing all the software packages on the new servers, the Virtualmin Installer does not install the necessary PHP5-GD package. Because of this, web pages with CAPTCHAs known to have been working before the upgrade, now give the "Fatal error: Call to undefined function imagetypes() in" PHP Error.

Or, more specifically, the error found was:

Fatal error: Call to undefined function imagetypes() in /home/DOMAIN-NAME/public_html/wp-content/plugins/contact-form-7/modules/captcha.php on line 350

Your server configuration and the line number, probably wont be the same as what I have found on mine.

All of this may seem complicated, but the fix is quite easy. All you need to do is install the GD Library of Image Functions.

  1. To do this, start by opening a terminal/console session and gaining "root" or "sudo"access. You would have set this password up during installation. See our Installing Debian 4.0 (etch) on a PC guide.
  2. Next update the available packages.
    test:~# apt-get update
  3. Now install the PHP5-GD package.
    test:~# apt-get install php5-gd
  4. Finally, restart Apache.
    test:~# /etc/init.d/apache2 restart

Now see if your CAPTCHA pages are working correctly. We have had this issue in the past after installing Virtualmin and have had other clients with this same issue (though usually in a non-virtualized environment). These steps have fixed the issue every time. If this does not fix the error, it may be necessary to install the FreeType libraries as well.