Missing Captcha Image
Permalink 1 user found helpfulLAMP system running 5.5.1 with shared concrete folder using Alias and php_value entries in common area of httpd.conf.
One site displays captcha fine. Other does not. So the problem isn't caused by a missing file or package, etc.
Both have the same user and group on all site specific files. Apache can write to folder, contents, and sub-directories of config, files, and packages.
The sites do have different themes, but I even temporarily renamed the local themes, packages, and blocks folders in effort to identify the cause.
I have cleared the cache both from the dashboard and command line.
It fails on new forms as well as existing ones such as register.
Could there be a setting in the database? Looked but didn't see anything.
It doesn't appear that the captcha image is stored or saved anywhere on the site that works.
I know I could probably get re-captcha to work instead, but I'd really like to know why one site works and the other doesn't.
Enabled error reporting in captcha.php. No message in browser. Apache access_log shows result code 200 for image even though image does not display. Apache error_log has no entry. /etc/php.ini does not have custom error_log entry.
Try adding this code into one of your templates:
[code]
<?php
$captcha = Loader::helper('validation/captcha');
var_dump($captcha);
$captcha->display();
?>
[code]
You should see a captcha image, and something that looks like this:
===================================================================
object(ValidationCaptchaHelper)#233 (1) { ["securimage:private"]=> object(Securimage)#234 (37) { ["image_width"]=> int(175) ["image_height"]=> int(45) ["image_type"]=> int(2) ["code_length"]=> int(4) ["charset"]=> string(29) "ABCDEFGHKLMNPRSTUVWYZ23456789" ["wordlist_file"]=> string(18) "../words/words.txt" ["use_wordlist"]=> bool(true) ["use_gd_font"]=> bool(false) ["gd_font_file"]=> string(22) "gdfonts/bubblebath.gdf" ["gd_font_size"]=> int(20) ["ttf_file"]=> string(80) "/var/www/concrete2/concrete/config/../libraries/3rdparty/securimage/elephant.ttf" ["font_size"]=> int(24) ["text_angle_minimum"]=> int(-20) ["text_angle_maximum"]=> int(20) ["text_x_start"]=> int(8) ["text_minimum_distance"]=> int(30) ["text_maximum_distance"]=> int(33) ["image_bg_color"]=> string(7) "#e3daed" ["text_color"]=> string(7) "#ff0000" ["use_multi_text"]=> bool(true) ["multi_text_color"]=> string(23) "#0a68dd,#f65c47,#8d32fd" ["use_transparent_text"]=> bool(true) ["text_transparency_percentage"]=> int(15) ["draw_lines"]=> bool(true) ["line_color"]=> string(7) "#80BFFF" ["line_distance"]=> int(5) ["line_thickness"]=> int(1) ["draw_angled_lines"]=> bool(false) ["draw_lines_over_text"]=> bool(false) ["arc_linethrough"]=> bool(true) ["arc_line_colors"]=> string(7) "#8080ff" ["audio_path"]=> string(8) "./audio/" ["im"]=> NULL ["bgimg"]=> NULL ["code"]=> NULL ["code_entered"]=> NULL ["correct_code"]=> NULL } }
===================================================================
Have you tried in another browser? I once managed to instruct firefox/adblock to not show certain images and spent a while figuring out what I'd done.
Also, if you haven't done so already, clear the C5 cache and turn off caching.
Adding code provided does display the variable dump in the browser, but the captcha box shows the broken-link image in a bordered box both in Chrome & IE. Firefox does not show the box, nor the image.
Other site that shares same core files displays captcha in all three browsers, so I don't think it is a server or browser issue.
Have disabled and cleared cache again without luck.
http://www.example.com/index.php/tools/required/captcha?nocache=1329861073
You should be able to type that URL in and it should produce the captcha image.
If you track down the path of the one that's broken, and compare it, maybe it's a bit different and that might explain what's happening.
http://www.drkstudio1.com/index.php/tools/required/captcha?nocache=...
Failing site image url:
http://test.excellware.com/index.php/tools/required/captcha?nocache...
Therefore, something somewhere is inserting a new line character into the image output stream. You want to check what's going on in the output() function in concrete/libraries/3rdparty/securimage/secureimage.php. I'd try pushing the output into a file and seeing what that gives you. It's definitely sending an image/png content type so either imagepng() is not behaving, or something has corrupted the image data before it's output as a png.
Can you post a link to a page on the non working site that has the issue? (registration page or one with comments)
http://www.drkstudio1.com/index.php/register/...
Failing site:
http://test.excellware.com/index.php/register/...
I have two sites which are pretty much the same, they both show the image on the local test server, and both live websites run on the same VPS. Yet one will show the image, and the other won't.
Any ideas? I'm getting the same issue that it appears that the image output stream is being corrupted before it is saved and loaded, running the secureimage.php file WILL generate a captcha, but doesn't display it on the registration page.
I haven't yet figured out how why one site on the server creates the image properly, and the other does not, when they share a common c5 code base, and there have been no customization to the captcha routines.
I thought it might have been a character set issue in the data base as there were some differences, but I have resolved them, yet the problem remains.
Deleted new line at end of file config/site.php so that the file ends with ?>
Just tried deliberately adding a new line on one of my sites, and it broke several other things - so useful to know to check this first. Rather surprised I've not fallen for this one before.
EDIT: Missing captcha-image has this URL: /index.php/tools/required/captcha?nocache=1367048368. Still, when i go to /tools with FileZilla there isnt even any /required folder?
Thanks!
http://www.concrete5.org/developers/bugs/5-6-1-2/captcha-display-pr...
Removing it ensures that any blank lines are treated as code, and not output as html. The first line in the file should be the one and only occurrence of <?php
Also, try adding this to the end of site.php:
if ( ! function_exists('imagettfbbox')) die('imagettfbbox does not exist');
If your site complains that the function imagettfbbox doesn't exist, you need to install the PHP modules that define it. This is a job for your website administrator.
I checked the coding of site.php and its UTF-8 (not BOM) so that should be fine.
Also i added the code jero offered to my site.php and the result was that i dont have imagettfbbox on my site so this must be the problem, right?
So its a pretty url issue.
So its a pretty url issue.
I found also that concrete/tools/captcha.php had all error reporting turned off. You might want to turn it all on and see if anything squeaks - it might provide some interesting information. In my case it revealed the 500 error and the imagettfbbox problem. Check error logs after doing this if you don't see anything in the browser.