“INTERNAL APPLICATION ERROR” when trying to upload a file in MantisBT during issue creation

✅ 1. Check PHP Configuration (php.ini)

MantisBT relies on PHP’s file upload settings. Check the following settings in your php.ini:

file_uploads = On
upload_max_filesize = 10M
post_max_size = 20M
max_file_uploads = 20

Make sure the values are large enough to accommodate your uploads.

🔁 Restart your web server (e.g., Apache or Nginx) after making changes.

✅ 2. Check MantisBT Configuration (config_inc.php)

Make sure these settings are correctly set:

$g_file_upload_method = DISK; // or DATABASE if you prefer DB storage
$g_absolute_path_default_upload_folder = ‘/var/www/mantisbt/uploads/’; // change to your writable path
$g_max_file_size = 10000000; // around 10 MB
$g_allowed_files = ”; // leave blank to allow all, or set e.g., ‘zip,docx,png,jpg,pdf’
$g_disallowed_files = ”; // e.g., ‘exe,php’

Also ensure that the upload folder has write permissions for the web server user (www-data, apache, etc.).
✅ 3. Enable Error Logging

To get more details on the actual cause:
Option A: Enable PHP error logging (php.ini)

log_errors = On
error_log = /var/log/php_errors.log

Option B: Enable detailed MantisBT error display

In config_inc.php (not recommended for production):

$g_show_detailed_errors = ON;
$g_display_errors = array(
E_ALL => ‘halt’,
);

⚠️ Be careful with this in a live system—it may reveal sensitive info.

✅ 4. File Permissions & Ownership

Ensure that the upload directory (if using DISK method) is writable:

sudo chown -R www-data:www-data /var/www/mantisbt/uploads/
sudo chmod -R 755 /var/www/mantisbt/uploads/

Replace www-data with your web server’s user.
✅ 5. Check Web Server Error Logs

Look at your web server logs to get more information:

tail -f /var/log/apache2/error.log
# or
tail -f /var/log/nginx/error.log

✅ 6. MantisBT Version Compatibility

Older versions of MantisBT may have issues with modern PHP versions. If you’re running PHP 8.x with an older MantisBT, consider upgrading MantisBT to a version that’s compatible (e.g., 2.25.2 or later).

Another Root Cause:
MantisBT is trying to detect the MIME type of the uploaded file using PHP’s FileInfo class. This is part of the fileinfo PHP extension, which is missing or not enabled on your server.

🛠 Solution: Install or Enable fileinfo PHP Extension
🔹 If you are on Linux (Ubuntu/Debian):

sudo apt-get install php-fileinfo
sudo systemctl restart apache2

Or for PHP 8.x specifically:

sudo apt-get install php8.1-fileinfo
sudo systemctl restart apache2

🔹 If you are on CentOS/RHEL:

sudo yum install php-fileinfo
sudo systemctl restart httpd

🔹 If you are on cPanel/WHM shared hosting:

Log into cPanel.

Find “Select PHP Version” or “PHP Extensions”.

Enable the checkbox for fileinfo.

Save and apply.

✅ Confirm It’s Working

You can create a phpinfo.php file to confirm:

<?php phpinfo(); ?>

Search for fileinfo on the page to confirm it’s now enabled.
🔄 Final Step: Retry File Upload in MantisBT

Once fileinfo is enabled, your file upload in the issue creation screen should work properly without triggering that internal error.

 

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

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

280 Views