Page 1 of 1

How to fix not working MantisBT

Posted: Nov 28, 2018 5:18 am
by Herbiek
We have a MantisBT installation running on a QNAP nas. Do not know which version (how can I find the version number assuming that Mantis is not running correctly)
I have changed the email address that have been setup in the config_inc.php file. I have taken care that the syntax is correctly etc. According to me nothing else changed, but since then I cant get a login prompt anymore.

The MySQL database is running ( I can login there with MyPHPadmin using the credentials mentioned in the config_inc.php file.
The webserver is also running because when I run the ./MantisBT.sh stop command the prompt is returned normally without any remark and if I visit the website of Mantis it showes that is it is currently in offline mode for mainteance purposes.

However when start Mantis again (./MantisBT.sh start ) and visit the website is stays completely empty, nothing is shown.

There seems to be no logging information available even though it has been enabled in the config_inc.php file by these line:

$g_log_level = LOG_EMAIL | LOG_EMAIL_RECIPIE:NT | LOG_FILTERING | LOG_AJAX | LOG_DATABASE | LOG_LDAP;
$g_log_destination = 'file:/var/mantis/log/mantisbt.log';
This directory is also deleted sometimes even when I create it again manually.

Can somebody give me some directions of what I can check? Or even better how to get it working again?

Kind regards, Herbert

Re: How to fix not working MantisBT

Posted: Nov 28, 2018 5:35 am
by atrol
Herbiek wrote:
Nov 28, 2018 5:18 am
(how can I find the version number assuming that Mantis is not running correctly)
There is a file core/constant_inc.php with a line similar to

Code: Select all

define( 'MANTIS_VERSION', '2.18.0' );
I can't tell that much about Mantis on QNAP nas, as I don't know how the QNAP guys install and configure the Web server, PHP and Mantis.
e.g. MantisBT.sh is not part of standard Mantis.

I recommend to check the Web server and PHP logs for errors.

To be sure, that the changed email address is not causing the issue, comment the line by adding a # as first character of the line.

Re: How to fix not working MantisBT

Posted: Nov 29, 2018 2:14 am
by Herbiek
Commented out all 2 lines containing a email address in the config_inc.php file but doesn't change behavior, still got a white page. Any other suggestions are welcome!

Assuming that webserver (Apache?) and PHP is running correctly (because the text in the offline modus is showing perfectly (generated by PHP code)
Is there a way I can check if MySQL is running correctly running? What else could be not working? I think apart from the 3 systems mentioned above the installation we have is not that different than a regular one? The *php code seems to be identical.

Basically the only thing that the ./MantisBT.sh script does for you is renaming the offline file that is being checked for in the core.php. (and start is removing that offline file again). See below:

Code: Select all

#!/bin/sh
CONF=/etc/config/qpkg.conf
QPKG_NAME="MantisBT"
QPKG_INSTALL_PATH=$(/sbin/getcfg $QPKG_NAME Install_Path -f $CONF)

case "$1" in
  start)
    ENABLED=$(/sbin/getcfg $QPKG_NAME Enable -u -d FALSE -f $CONF)
    if [ "${ENABLED}" != "TRUE" ]; then
        echo "${QPKG_NAME} is disabled."
        exit 1
    fi
    : ADD START ACTIONS HERE
    if [ "${QPKG_INSTALL_PATH}" != "UNKNOWN" ]; then
        /bin/rm ${QPKG_INSTALL_PATH}/web/mantis_offline.php
    else
        echo "${QPKG_NAME} Install_Path is ${QPKG_INSTALL_PATH}"
    fi
    ;;

  stop)
    : ADD STOP ACTIONS HERE
    if [ "${QPKG_INSTALL_PATH}" != "UNKNOWN" ]; then
        /bin/cp ${QPKG_INSTALL_PATH}/web/mantis_offline.php.qnap ${QPKG_INSTALL_PATH}/web/mantis_offline.php
    else
        echo "${QPKG_NAME} Install_Path is ${QPKG_INSTALL_PATH}"
    fi
    ;;

  restart)
    $0 stop
    $0 start
    ;;

  *)
    echo "Usage: $0 {start|stop|restart}"
    exit 1
esac

exit 0
Any help/suggestions is welcome!

Re: How to fix not working MantisBT

Posted: Nov 29, 2018 2:40 am
by atrol
I think I got it, there is a bug in this line

Code: Select all

$g_log_level = LOG_EMAIL | LOG_EMAIL_RECIPIE:NT | LOG_FILTERING | LOG_AJAX | LOG_DATABASE | LOG_LDAP;
As a first step comment out the line, to check if it's causing the issue.
At least LOG_EMAIL_RECIPIE:NT is wrong, it should be LOG_EMAIL_RECIPIENT

Re: How to fix not working MantisBT

Posted: Nov 29, 2018 3:47 am
by Herbiek
@Atrol, you are my hero! :D :D :mrgreen: Its working again! Edited the file with VI and the : was typed where it should not be.
Strange that such a simple type could cause this ;-)
Thank you very much for helping me with this!

Re: How to fix not working MantisBT

Posted: Nov 29, 2018 4:50 am
by atrol
Herbiek wrote:
Nov 29, 2018 3:47 am
Strange that such a simple type could cause this ;-)
Not strange ;-), it's just the way how PHP and similar interpreted programming languages work.

You introduced a syntax error in PHP code (LOG_EMAIL_RECIPIE:NT is not known by the system).
Ignoring the error is no option, as there might occur other errors because of this error.
So the system stops to prevent side effects.
The error is logged in your web server or PHP error log, that's why I recommended to check the logs.
Typically (depends on configuration) such errors are not displayed in browser, as such messages can contain internal information which could be used by attackers to hack your server.

BTW Mantis 1.2.x is quite outdated and there are some known security issues in it.
It's no problem to go on using it as a private system, but I wouldn't go on using it if your system can be reached by anyone via web.

Re: How to fix not working MantisBT

Posted: Nov 29, 2018 7:45 am
by Herbiek
I searched for but could not find the logging files of PHP and webserver.

The logging folder that is defined for Mantis has to be recreated some times after rebooting the NAS but even then it never contains any file. (while it definitely is visible that it's not there by the many warnings in the browser when its gone (chmod 777)

I'm planning on moving the database to the recent version of MantisBT version 2.18.0 running on a Bitnami VM (got that VM and Mantis version already running).
Can I ask that over here or shall I create a new ticket if this is possible without any expected issues?