Fix Mantis Captcha Image open_basedir Error

I recently installed the lastest version of Mantis Bug Tracker. Sadly when I tried to signup for the first time, the captcha used in the signup form didn’t show up. Opening the generated jpeg file reveals several errors related to my server’s PHP security settings.

SYSTEM WARNING: ‘file_exists(): open_basedir restriction in effect. File(/usr/share/fonts/corefonts/) is not within the allowed path(s)

mantis/core/utility_api.phpin utility_api.php’ line 253
mantis/core/utility_api.phputility_api.php’ line 255
mantis/core/utility_api.php line 257
mantis/make_captcha_img.php line 124

To fix the problem I added a fonts folder within my Mantis installation root, added the ARIAL.TTF font file inside that folder and then added a $g_system_font_folder variable to the mantis configuration file config_inc.php to point to the fonts folder.

Step by step guide

Open the Windows Fonts folder in your Control Panel
Double-click on Arial to open the contents
Select Arial Regular and right-click > Copy (or Ctrl+C)
Add a folder named fonts in the Mantis folder
Paste the Arial file into the fonts folder and rename arial.ttf file to upper case ARIAL.TTF

 

Add $g_system_font_folder = __DIR__ . '/fonts'; to config_inc.php

Last step is to upload config_inc.php and the fonts folder to your web hosting.

Leave a Reply

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