After installing CAPTCHA and enabling image captcha I do not see any images when a captcha is displayed. The drupal path /drupal/?q=image_captcha/1083161521 (for example) returns nothing. I have installed True Type font, and tried using the built it font. I've also googled extensively but can not find the source of my issue. I see nothing in the drupal logs or the apache logs. Any insight on how I might debug this further would be very much appreciated.

Here the apache log:
[04/Dec/2007:17:02:04 -0800] "GET /drupal/?q=image_captcha/1414079898 HTTP/1.1" 200 1424 "http://xx.xx.xx.xx/drupal/?q=admin/user/captcha/captcha/examples" "Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11" (Ip removed to protect my unready server)

I'm using:
Captcha 5.x-3.1
Drupal 5.3
RHEL 5.0
PHP 5.1.6
Apache 2.2.3
Mysql 5.0.22

Thanks,

Ian

Comments

soxofaan’s picture

Is there an Image CAPTCHA error in your status report (?q=admin/logs/status)?

igable’s picture

From the status I see:

GD library bundled (2.0.28 compatible)

with a green check mark. I also have php-gd installed as a system library (Version bundled with PHP 5.1.6). Could this somehow be a source of trouble?

soxofaan’s picture

Here are some threads that could help debug your problem:
http://drupal.org/node/195502
http://drupal.org/node/183608

igable’s picture

Here's the output from running the test suggested in thread http://drupal.org/node/18360. It would appear that I have True Type support.

array ( 'GD Version' => 'bundled (2.0.28 compatible)', 'FreeType Support' => true, 'FreeType Linkage' => 'with freetype', 'T1Lib Support' => false, 'GIF Read Support' => true, 'GIF Create Support' => true, 'JPG Support' => true, 'PNG Support' => true, 'WBMP Support' => true, 'XPM Support' => false, 'XBM Support' => true, 'JIS-mapped Japanese Font Support' => false, )imagejpeg: true
imagecreatetruecolor: true
imagedestroy: true
imagecolorallocate: true
imagefilledrectangle: true
imagecolorat: true
imagesetpixel: true
imageline: true
imagefontwidth: true
imagettfbbox: true
imagestring: true
imagettftext: true

The other difference I see relative to the previous fellows is "'XPM Support' => false". Does that happen to be important.
Also logged in as administrator I do not see captcha images so it's not the anonymous user issue in thread http://drupal.org/node/195502. soxofaan thanks for the very high levels of support you are providing.

I also want to mention that I've disabled and enabled the module once before.

igable’s picture

Also I've just tried commenting out the two lines as suggested in http://drupal.org/node/195502:

  // unset the code from $_SESSION to prevent rerendering the CAPTCHA
  // unset($_SESSION['image_captcha'][$seed]);

 // drupal_set_header("Cache-Control: max-age=3600, must-revalidate");

and then restarting httpd. I've also tried commenting them out one at a time.

igable’s picture

Also Math Captcha works perfectly (including validation).

soxofaan’s picture

Also logged in as administrator I do not see captcha images so it's not the anonymous user issue in thread http://drupal.org/node/195502.

I mentioned this thread because of the debugging tricks, not because of the error source.

For example: after you disabled those lines, what happens if you request the image urls themselves? see http://drupal.org/node/195502#comment-640894

soxofaan’s picture

Status: Active » Postponed (maintainer needs more info)
ali_a’s picture

I have the same problem, no image is shown. At first I had this error in my status page:

Image CAPTCHA No FreeType support
FreeType support is required for working with TrueType fonts (.ttf), but the GD library for PHP does not support it

So i contacted my hosting support and they resolved the problem. (now I don't have any captcha error report) but still no images ! I tried uninstalling, deleting,reuploading and enabling it but no use. I uploaded the same file on another website of mine and it works there but not here.

Please help!

Drupal 5.5
MySQL database 5.0.45
PHP 5.2.5
Web server Apache/1.3.39 (Unix) PHP/5.2.5 mod_log_bytes/1.2 mod_bwlimited/1.4 mod_auth_passthrough/1.8 FrontPage/5.0.2.2635 mod_ssl/2.8.30 OpenSSL/0.9.7a

ali_a’s picture

I found the problem! I have disabled a module we have created and it worked! here is the content of that module:

function elnit_login_redir_user($op, &$edit, &$account, $category = NULL) {
if ($op == 'login' && $_GET['continue'] != '') {
drupal_goto(urldecode($_GET['continue']));
} else if ($op == 'logout') {
drupal_goto('msg/logged-out');
}
}
?>

can you please tell me why it conflicts with captcha?

emosbaugh’s picture

just had a similar problem.

turns out it was a space/newline character outside the tags in my custom module

soxofaan’s picture

turns out it was a space/newline character outside the <?php ?> tags in my custom module

This is indeed a possible cause of the CAPTCHA image not showing up
more info at http://drupal.org/node/271883#comment-889163

zwoop’s picture

So, how do you go ahead and debug a problem like this? I have this exact problem too (no 'text' in the image captcha, but if I enable static noise, that shows up). I've verified (using the PHP script posted) that my PHP and GD supports TTF. I actually don't have any custom modules on my site, only a number of modules downloaded from Drupal, so not sure which one might be causing this.

soxofaan’s picture

@zwoop: if you get an image, but without characters, only a background (and noise if set up like that), this is not the right issue thread to discuss your problem. Please start a new issue for this. Questions: does the built-in font work? have you tried other TTF fonts?

rvarkonyi’s picture

I had the same problem, on Drupal 6 though. The problem was that for some reason uid = 0 was deleted from the {users} table in MySQL. I inserted uid = 0 manually and the image captcha works now fine. Hopefully it helps someone.

Rob

zwoop’s picture

@saxofaan: Yeah, the built in font works, I see all the TTF fonts in the selection list, but none of them "renders". I've checked that my "gd" and PHP is compiled with TT support (I even rebuilt PHP again, just to be certain).

Thanks for the suggestions, I'll file a different bug for this.

voxpelli’s picture

I have the same problem on Drupal 6 that when using TTF-fonts no image is shown. Debugging it I have found that the script is completely choking on the call to imagettfbbox without any PHP errors thrown.

Should mention that I have TTF support in my PHP.

soxofaan’s picture

at voxpelli in #17: did you try with different TTF fonts? does the built in font work?

voxpelli’s picture

@soxofaan: Yes - I tried with different TTF fonts and yes the built in font work because it doesn't call imagettfbbox which is the function that doesn't work on my local OS X webserver.

I uploaded the module to another server with a bit different/older setup and there it worked.

I suspect that it is a flaw in the PHP setup that I have locally which makes imagettfbbox go crazy.

Vasilich’s picture

/admin/logs/status
Image CAPTCHA No FreeType support
FreeType support is required for working with TrueType fonts (.ttf), but the GD library for PHP does not support it.

baricada ~ # uname
Linux
baricada ~ # uname -r
2.6.28-gentoo-r5

baricada ~ # emerge -pv apache

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild     U ] www-servers/apache-2.2.11-r2 [2.2.11] USE="ldap ssl suexec -debug -doc (-selinux) -sni -static -threads" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias -asis -auth_digest -authn_dbd -cern_meta -charset_lite -dbd -dumpio -ident -imagemap -log_forensic -proxy -proxy_ajp -proxy_balancer -proxy_connect -proxy_ftp -proxy_http -substitute -version" APACHE2_MPMS="itk -event -peruser -prefork -worker" 0 kB

Total: 1 package (1 upgrade), Size of downloads: 0 kB

 * IMPORTANT: 1 news items need reading for repository 'gentoo'.
 * Use eselect news to read news items.

baricada ~ # emerge -pv php

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild     U ] dev-lang/php-5.2.10 [5.2.9-r2] USE="apache2 berkdb bzip2 cgi cli crypt ctype curl ftp gd gdbm gmp iconv imap ipv6 ldap ldap-sasl mysql ncurses nls pcre postgres readline reflection session snmp sockets spl ssl unicode xml zip zlib -adabas -bcmath -birdstep -calendar -cdb -cjk -concurrentmodphp -curlwrappers -db2 -dbase -dbmaker -debug -discard-path -doc -empress -empress-bcs -esoob -exif -fastbuild -fdftk -filter -firebird -flatfile -force-cgi-redirect -frontbase -gd-external -hash -inifile -interbase -iodbc (-java-external) -json -kerberos -kolab -libedit -mcve -mhash -msql -mssql -mysqli -oci8 -oci8-instant-client -odbc -pcntl -pdo -pic -posix -qdbm -recode -sapdb -sharedext -sharedmem -simplexml -soap -solid -spell -sqlite -suhosin -sybase -sybase-ct -sysvipc -threads -tidy -tokenizer -truetype -wddx -xmlreader -xmlrpc -xmlwriter -xpm -xsl -yaz (-zip-external%)" 0 kB

Total: 1 package (1 upgrade), Size of downloads: 0 kB

 * IMPORTANT: 1 news items need reading for repository 'gentoo'.
 * Use eselect news to read news items.

baricada ~ # emerge -pv gd

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild   R   ] media-libs/gd-2.0.35  USE="fontconfig jpeg png truetype -xpm" 0 kB

Total: 1 package (1 reinstall), Size of downloads: 0 kB

 * IMPORTANT: 1 news items need reading for repository 'gentoo'.
 * Use eselect news to read news items.

WHY?

soxofaan’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

Closing old/outdated issues for 5.x releases, which is officially unsupported now.

If this issue still exists for Drupal6 or Drupal7, please reopen (and update the version)