View Issue Details

IDProjectCategoryView StatusLast Update
0020908mantisbtsignuppublic2016-06-01 16:08
Reportersuperkarl Assigned Toatrol  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionno change required 
Platformamd64OSubuntu serverOS Version14.04 LTS
Product Version1.2.19 
Summary0020908: Captcha image doesn't work
Description

I migrated the MantisBT from local server to a cloud server several days ago. And found that the captcha image function doesn't work anymore. The function works well on the local server.

The local server uses the following software:
CentOS 7.2 amd64
MySQL 5.6.27
PHP 5.6.14
HTTPD 2.4.16

But the cloud server uses new software:
Ubuntu server amd64 14.14 lts
MySQL 5.7.12
PHP 5.6.21
HTTPD 2.4.20

Does the new software bring the problem? And how can I fix it? Currently, I just disabled the function.

By the way, on the cloud server, I have the following warning at the top of every page:

SYSTEM WARNING: 'mysql_connect(): Headers and client library minor version mismatch. Headers:50712 Library:50549' in '/data/www-data/mantisbt-1.2.19/library/adodb/drivers/adodb-mysql.inc.php' line 365

TagsNo tags attached.

Activities

atrol

atrol

2016-05-14 05:00

developer   ~0053137

superkarl,

This is not a bug or feature request for MantisBT (you are asking for help on how to configure the system). I am therefore resolving this issue as "no change required".

Please use the forums, the mantisbt-help mailing list or IRC to get support on customizing and using MantisBT (refer to http://www.mantisbt.org/support.php for links and further details).

Ensure that

  • $g_system_font_folder points to the right location
  • font specified in $g_font_per_captcha exists in directory
  • GD library is installed and enabled

Check that running admin/check.php does not output any errors or warnings.
Check also your web server logs for errors and warnings.

Feel free to reopen this issue, if you think this a bug but no configuration issue.

If so, keep in mind that the provided information is not sufficient to provide any help in resolving the issue. A complete and detailed description is required for the support team to get a clear understanding of the problem.

You have to provide detailed, step-by-step instructions to reproduce the issue; the additional information listed below may also be useful:

  • Exact version of PHP, Database, Web server, Browser and Operating System
  • Relevant customizations (e.g. changes in config_inc.php, etc)
  • Installed plugins or custom functions ?
  • Was the MantisBT source code modified in any way ?
superkarl

superkarl

2016-05-16 01:48

reporter   ~0053141

I use default values for $g_font_per_captcha and $g_system_font_folder on local server and cloud server. Aka:
$g_system_font_folder='';
$g_font_per_captcha=‘arial.ttf’;

I searched the font 'arial.ttf' on local server (sudo find / -name 'arial.ttf'), but failed to find it. However, the function just works. I don't know why.

I also searched the font 'arial.ttf' on cloud server, and didn't find it neither. So I copied the 'arial.ttf' from windows and put it in /usr/shared/fonts on cloud server. And set the $g_system_font_folder='/usr/share/fonts/'. Still, captcha image doesn't work. Next I set $g_font_per_captcha='DejaVuSans.ttf' (The path for this font is /usr/share/fonts/truetype/dejavu/DejaVuSans.ttf). Still, captcha image doesn't work.

////////////////////////////////////////////////////////////////
I checked the GD library, the following are the outputs from phpinfo():
GD Support enabled
GD Version bundled (2.1.0 compatible)
FreeType Support enabled
FreeType Linkage with freetype
FreeType Version 2.5.2
GIF Read Support enabled
GIF Create Support enabled
JPEG Support enabled
libJPEG Version 8
PNG Support enabled
libPNG Version 1.2.50
WBMP Support enabled
XBM Support enabled

gd.jpeg_ignore_warning 0 0

////////////////////////////////////////////////////////////////
I checked the admin/check.php, it says all tests are good. I also checked the logs, and cannot find any warning or error related to this function (The only warning is about openssl session cache).

////////////////////////////////////////////////////////////////
So I think it is a bug. Here are the details you need:
OS: Ubuntu server amd64 14.14 lts
MySQL: 5.7.12
PHP: 5.6.21
HTTPD: 2.4.20
Browser: Chrome v50.0.2661.102 m
Installed plugin:
Mantis Graphs 1.0
MantisBT Core 1.2.19
MantisBT Formatting 1.0b

No MantisBT source was modified.

////////////////////////////////////////////////////////////////
A portion of config_inc.php:
...
$g_allow_file_upload = ON;
$g_file_upload_method = DATABASE; # or DISK
$g_absolute_path_default_upload_folder = ''; # used with DISK, must contain trailing \ or /.
$g_max_file_size = 5000000; # in bytes
$g_preview_attachments_inline_max_size = 256 * 1024;

$g_signup_use_captcha = ON;
$g_system_font_folder ='/usr/share/fonts/';
$g_font_per_captcha = 'arial.ttf';

$g_log_level = LOG_EMAIL | LOG_EMAIL_RECIPIENT | LOG_DATABASE;
$g_log_destination = 'file:/data/tools/repository/httpd/logs/mantisbt.log';
...

superkarl

superkarl

2016-05-16 01:49

reporter   ~0053142

I did all I can, but the function still doesn't work.

atrol

atrol

2016-05-16 04:40

developer   ~0053143

To exclude the client side, do you see the captcha image at http://atrol.de/mantisbt-1.2.19/signup_page.php ?

superkarl

superkarl

2016-05-16 04:50

reporter   ~0053144

Yes, I can see the captcha image at http://atrol.de/mantisbt-1.2.19/signup_page.php.

atrol

atrol

2016-05-16 05:02

developer   ~0053145

Don't set $g_system_font_folder
After that, does installing package msttcorefonts fix the issue?

superkarl

superkarl

2016-05-16 06:38

reporter   ~0053151

I deleted the 'arial.ttf' which I copied from windows, removed the following lines from config_inc.php, installed msttcorefonts and restarted httpd, still, it doesn't work.

$g_signup_use_captcha = ON;
$g_system_font_folder ='/usr/share/fonts/';
$g_font_per_captcha = 'arial.ttf';

atrol

atrol

2016-05-16 07:56

developer   ~0053153

Temporary change line 80 of file make_captcha_img.php

from
var $debug = FALSE;
to
var $debug = TRUE;

Right click on the place where the image should be displayed and choose something like "Open picture in new tab"
Which output do you get in the new tab?

superkarl

superkarl

2016-05-16 09:57

reporter   ~0053155

In the new tab, I can see some debug logs and the captcha image!

-Captcha-Debug: The available GD-Library has major version 2
-Captcha-Debug: Extracts Config-Array in unsecure-mode!
-Captcha-Debug: Check given TrueType-Array! (1)
-Captcha-Debug: Valid TrueType-files: (1)
-Captcha-Debug: Set current TrueType-File: (/usr/share/fonts/truetype/msttcorefonts/arial.ttf)
-Captcha-Debug: Set number of noise characters to: (0)
-Captcha-Debug: Set image dimension to: (120 x 36)
-Captcha-Debug: Retrieved image from cache.
-Captcha-Debug: Generated image (2486 bytes):

atrol

atrol

2016-05-17 02:50

developer   ~0053161

SYSTEM WARNING: 'mysql_connect(): Headers and client library minor version mismatch

It's not a Mantis issue, but a PHP/MySQL issue.
Search the web for solutions, e.g. http://stackoverflow.com/questions/10759334/headers-and-client-library-minor-version-mismatch

This is hardly related to the captcha issue but should certainly be fixed in a first step.

superkarl

superkarl

2016-05-17 07:34

reporter   ~0053163

I changed the mysql client from mysql to mysqli. It worked. The warning went away and captcha image function works very well.

Thank you very much.

atrol

atrol

2016-05-17 07:56

developer   ~0053164

Thanks for the feedback.

mysql has been deprecated since PHP 5.5 and has been removed in PHP 7.0 [1]

Seems that using mysql extension in PHP 5.6 in combination with a newer MySQL server introduces some strange side effects.

Anyway, we will always use mysqli in Mantis 1.3 if PHP version is 5.5. or newer, see 0016941.

[1] http://php.net/manual/en/changelog.mysql.php