View Issue Details

IDProjectCategoryView StatusLast Update
0035540mantisbtinstallationpublic2025-03-14 19:10
Reporterkodiak Assigned Todregad  
PrioritynormalSeverityblockReproducibilityhave not tried
Status resolvedResolutionfixed 
Product Version2.27.1 
Fixed in Version2.28.0 
Summary0035540: A clean installation ends with Internal Server Error with no message/detail given
Description

First of all, I tried to post the text below to the forum, but my ISP (T-mobile) has been blacklisted.

Hello,

I have been struggling with instalattion process on a webhosting.

I check requirements several times and they should be fine:
https://mantis.vwg-displays.eu/info.php

Info from PHPMyAdmin:
Database server
Server: md418.wedos.net via TCP/IP
Software: MariaDB
Software version: 10.4.34-MariaDB-log - Source distribution
Protocol version: 10
User: a368768_mantis@10.28.20.28
Server charset: UTF-8 Unicode (utf8)
Web server
Apache
Database client version: libmysql - 5.6.15
PHP extension: mysqli Documentation

After opening https://mantis.vwg-displays.eu/admin/install.php, I filled database credentials I got.
https://mantis.vwg-displays.eu/mantis_pre_inst_check.PNG

After submitting, I got a generic error message:

INTERNAL APPLICATION ERROR
Please use the "Back" button in your web browser to return to the previous page. There you can correct whatever problems were identified in this error or select another action. You can also click an option from the menu bar to go directly to a new section.

I also tried to generate SQL queries, but unsuccessfully.

I tried to create "config_inc.php" manually and it seems scripts can establish an SQL connection to the DB server (and of course are unable to see the DB content because it is empty).

Beside that, I tested the DB connection with this script:
https://gist.github.com/FGDATA/37e8c0d4ca6b15ac7046ad7c28e9ef42

Result:
https://mantis.vwg-displays.eu/db-connect-test.php

I registered a freehosting, where I was able to generate SQL queries, but it also failed.

Error
SQL query: Copy

-- Schema step 159
ALTER TABLE mantis_bug_revision_table ADD INDEX idx_bug_rev_id_time (bug_id, timestamp);
MySQL said: Documentation

0001061 - Duplicate key name 'idx_bug_rev_id_time'

TagsNo tags attached.

Relationships

related to 0034783 closeddregad Checking URL to installation is failing 
related to 0035550 confirmed Use GuzzleHttp request in url_get() 

Activities

dregad

dregad

2025-03-06 05:20

developer   ~0069944

After submitting, I got a generic error message:
INTERNAL APPLICATION ERROR

Can you please temporarily edit config_defaults_inc.php, and set $g_show_detailed_errors = ON; then try the installation again.
The error page should display a stack trace, please report that here (be careful to mask any sensitive information)

Your connection test mentions that there is 1 table in the DB, what is it ?

I registered a freehosting, where I was able to generate SQL queries, but it also failed.
[...]
-- Schema step 159
0001061 - Duplicate key name 'idx_bug_rev_id_time'

That index should have been dropped at step 154.

kodiak

kodiak

2025-03-07 15:23

reporter   ~0069963

Last edited: 2025-03-07 18:10

INTERNAL APPLICATION ERROR

Call to undefined function shell_exec()

Detailed error information
Full path: /data/web/virtuals/368768/virtual/www/subdom/mantis/core/error_api.php
Line number: 95
Stack trace
#   Filename    Line    Class   Type    Function    Args
0   /data/web/virtuals/368768/virtual/www/subdom/mantis/admin/install.php   498 -   -   url_get <string>'https://mantis.vwg-displays.eu/subdom/mantis/'

This is strange, because I tried to set $g_path to 'https://mantis.vwg-displays.eu/' as is supposed to.

Regarding the DB test, I created one table (which does not interfere with mantis) to test the same credentials (server/login/password/db) I also use for mantis.

dregad

dregad

2025-03-07 18:48

developer   ~0069964

OK so you seem to be hitting a variant of 0034783.

I tried to set $g_path to 'https://mantis.vwg-displays.eu/' as is supposed to.

This is not the issue. The problem is a shortcoming of url_get() function, combined with your system's PHP config, which I guess has the following characteristics:

  • allow_url_fopen = OFF
  • curl extension not installed
  • shell_exec disabled

The last point causes an error as url_get() never considered that shell_exec() would be unavailable. Clearly, yet another shortcoming of that api, which needs to be fixed as mentioned in 0034783:0069295.

As a workaround, you can try one of these approaches:

  • installing curl extension
  • patch url_get() function in core/url_api.php, so it does not try to execute shell_exec() if the function is not present, as follows:

    
    diff --git a/core/url_api.php b/core/url_api.php
    index bb4962baa..77ac9d673 100644
    --- a/core/url_api.php
    +++ b/core/url_api.php
    @@ -74,6 +74,10 @@ function url_get( $p_url ) {
        }
    
        # Last resort system call
  • $t_url = escapeshellarg( $p_url );
  • return shell_exec( 'curl ' . $t_url );
  • if( function_exists( 'shell_exec' ) ) {
  • $t_url = escapeshellarg( $p_url );
  • return shell_exec( 'curl ' . $t_url );
  • }
  • return null;
  • replace the $t_page_contents = url_get( $f_path ); at line by $t_page_contents = null;

Then the installer will show you a warning, but the installation should continue.

Let me know how it goes.

dregad

dregad

2025-03-07 19:15

developer   ~0069965

PR https://github.com/mantisbt/mantisbt/pull/2117 implements a function_exists() check to prevent the error from occuring - url_get() will just return null if shell_exec() is not available.

kodiak

kodiak

2025-03-11 10:48

reporter   ~0069981

Hello,

I have allow_url_fopen = ON and CURL installed, only shell_exec is disabled (it seems to be a common practise for some webhosting services).

It seems everything runs fine after the patch.

Thank you very much!

dregad

dregad

2025-03-11 12:40

developer   ~0069985

I have allow_url_fopen = ON and CURL installed

Then it's a bit strange that url_get() would fall back to calling shell_exec()... But anyway if it works for you now then it's good enough for me.

Thanks for the feedback, I'll merge the PR soon.

Related Changesets

MantisBT: master 810303b0

2025-03-07 18:56

dregad


Details Diff
Prevent internal application error in url_get()

When allow_url_fopen = OFF, curl extension is not installed, url_get()
falls back to a shell_exec() call to run curl, but if shell_exec()
function is disabled in php.ini, then an internal application error is
thrown.

This checks that shell_exec() function exists before calling it, and
returns null if not.

Fixes 0035540
Affected Issues
0035540
mod - core/url_api.php Diff File