Problems installing Mantis 2.7.0 on Ubuntu 16.04 with PHP 7

Get help from other users here.

Moderators: Developer, Contributor

Post Reply
Morgano
Posts: 4
Joined: 13 Oct 2017, 16:38

Problems installing Mantis 2.7.0 on Ubuntu 16.04 with PHP 7

Post by Morgano »

Hi,

I am having problems installing Mantis 2.7.0 on Ubuntu 16.04. This machine has PHP 7.0.22-0

When I browse to the installation page http://<IP address>/mantis/admin/install.php the page is not rendered properly; I just see the source code as text. Here is the first half-page:

Code: Select all

. /** * Mantis Database installation process * * @package MantisBT * @copyright Copyright 2000 - 2002 Kenzaburo Ito - kenito@300baud.org * @copyright Copyright 2002 MantisBT Team - mantisbt-dev@lists.sourceforge.net * @link http://www.mantisbt.org */ error_reporting( E_ALL ); @set_time_limit( 0 ); # Load the MantisDB core in maintenance mode. This mode will assume that # config/config_inc.php hasn't been specified. Thus the database will not be opened # and plugins will not be loaded. define( 'MANTIS_MAINTENANCE_MODE', true ); require_once( dirname( dirname( __FILE__ ) ) . '/core.php' ); require_api( 'install_helper_functions_api.php' ); require_api( 'crypto_api.php' ); $g_error_send_page_header = false; # bypass page headers in error handler $g_failed = false; $g_database_upgrade = false; /** * Print Test result * * @param integer $p_result Result - BAD|GOOD. * @param boolean $p_hard_fail Fail installation or soft warning. * @param string $p_message Message to display to user. * @return void */ function print_test_result( $p_result, $p_hard_fail = true, $p_message = '' ) { global $g_failed; echo 'BAD'; } else { echo 'class="warning">POSSIBLE PROBLEM'; } if( '' != $p_message ) { echo '
' . $p_message; } } if( GOOD == $p_result ) { echo 'class="success">GOOD'; } echo ''; } /** * Print Test result * * @param string $p_test_description Test Description. * @param integer $p_result Result - BAD|GOOD. * @param boolean $p_hard_fail Fail installation or soft warning. * @param string $p_message Message to display to user. * @return void */ function print_test( $p_test_description, $p_result, $p_hard_fail = true, $p_message = '' ) { echo '' . $p_test_description . ''; print_test_result( $p_result, $p_hard_fail, $p_message ); echo '' . "\n"; } # install_state # 0 = no checks done # 1 = server ok, get database information # 2 = check the database information # 3 = install the database # 4 = get additional config file information # 5 = write the config file # 6 = post install checks # 7 = done, link to login or db updater $t_install_state = gpc_get_int( 'install', 0 ); layout_page_header_begin( 'Administration - Installation' ); html_javascript_link( 'install.js' ); layout_page_header_end(); layout_admin_page_begin(); ?>
Back to Administration
Checking Installation
array( 'db_table_prefix' => 'm', 'db_table_plugin_prefix' => 'plg', 'db_table_suffix' => '', ) , ); foreach( $t_prefix_defaults['oci8'] as $t_key => $t_value ) { $t_prefix_defaults['other'][$t_key] = config_get( $t_key, '' ); } if( $t_config_exists && $t_install_state <= 1 ) { # config already exists - probably an upgrade $f_dsn = con
Any ideas what might be causing this?

The mantis PHP is being served from /www/html/mantis

Thanks!
atrol
Site Admin
Posts: 8366
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Problems installing Mantis 2.7.0 on Ubuntu 16.04 with PH

Post by atrol »

Did you install libapache2-mod-php7.0?
Please use Search before posting and read the Manual
Morgano
Posts: 4
Joined: 13 Oct 2017, 16:38

Re: Problems installing Mantis 2.7.0 on Ubuntu 16.04 with PH

Post by Morgano »

@atrol Thanks for your reply

I hadn't seen that requirement in the pre-requisites - so, no, I hadn't installed libapache2-mod-php7.0.

Done so now though, and pleased to say it's working fine!

Thanks again for the help!
atrol
Site Admin
Posts: 8366
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Problems installing Mantis 2.7.0 on Ubuntu 16.04 with PH

Post by atrol »

Good to hear that it works now.
Morgano wrote:I hadn't seen that requirement in the pre-requisites - so, no, I hadn't installed libapache2-mod-php7.0.
It's documented in a generic way as it's different depending on Operating System, Web Server and PHP version.
https://www.mantisbt.org/docs/master/en ... s.software
The web server must support PHP. It can be installed as CGI or any other integration technology.
Please use Search before posting and read the Manual
Morgano
Posts: 4
Joined: 13 Oct 2017, 16:38

Re: Problems installing Mantis 2.7.0 on Ubuntu 16.04 with PH

Post by Morgano »

OK, getting further now, but still hit a problem.

I've moved my 'config_inc.php' and 'custom_strings_inc.php' into the './config' sub-folder, as the location for the config files appeared to have moved.

I have typed a random string into the new '$g_crypto_master_salt' field.

I have changed the '$g_db_type' field in 'config_inc.php' from 'mysql' to 'mysqli'. If I run a 'diff' between my 'config_inc.php' and the 'config_inc.php.sample' file, the only difference are some email preferences, and some custom categories and colours.

I now get an error: 'Config File Exists but Database does not - POSSIBLE PROBLEM Bad config_inc.php?' All other checks are GOOD.

MySQL version is 5.7.19. My database name is 'mantis', and this is set correctly in the 'Database name (for Database)' setting.

I can use 'mysql' script from command line to view mantis database OK. It seems fine, all tables are there etc.

Code: Select all

mysql> use mantis;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> show tables;
+-----------------------------------+
| Tables_in_mantis                  |
+-----------------------------------+
| mantis_bug_file_table             |
| mantis_bug_history_table          |
| mantis_bug_monitor_table          |
| mantis_bug_relationship_table     |
| mantis_bug_revision_table         |
| mantis_bug_table                  |
| mantis_bug_tag_table              |
| mantis_bug_text_table             |
| mantis_bugnote_table              |
| mantis_bugnote_text_table         |
| mantis_category_table             |
| mantis_config_table               |
| mantis_custom_field_project_table |
| mantis_custom_field_string_table  |
| mantis_custom_field_table         |
| mantis_email_table                |
| mantis_filters_table              |
| mantis_news_table                 |
| mantis_plugin_table               |
| mantis_project_file_table         |
| mantis_project_hierarchy_table    |
| mantis_project_table              |
| mantis_project_user_list_table    |
| mantis_project_version_table      |
| mantis_sponsorship_table          |
| mantis_tag_table                  |
| mantis_tokens_table               |
| mantis_user_pref_table            |
| mantis_user_print_pref_table      |
| mantis_user_profile_table         |
| mantis_user_table                 |
+-----------------------------------+
31 rows in set (0.00 sec)

mysql>
atrol
Site Admin
Posts: 8366
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Problems installing Mantis 2.7.0 on Ubuntu 16.04 with PH

Post by atrol »

No idea what's wrong.
Did you double check that all related settings are correct?

Code: Select all

$g_hostname               = 'localhost/yourRemoteHost';
$g_db_type                = 'mysqli';
$g_database_name          = 'yourDatabase';
$g_db_username            = 'yourUser';
$g_db_password            = 'yourPassword';
Please use Search before posting and read the Manual
Morgano
Posts: 4
Joined: 13 Oct 2017, 16:38

Re: Problems installing Mantis 2.7.0 on Ubuntu 16.04 with PH

Post by Morgano »

Finally got this sorted, after several hours of Googling!

I believe the problem centred around the fact that I had a blank password on the database, MySQL has changed how it handles these in 5.7.x. - it now uses the 'auth-socket' plugin, and maybe this has caused an incompatiblity with how Mantis/PHP accesses the DB?

I needed to follow the procedure in this post to get it to work:

https://www.percona.com/blog/2016/03/16 ... th_socket/

In a nutshell, I had to run this mysql command:

Code: Select all

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'Password';
(replacing Password with actual password).

Anyway, it works OK now and I have Mantis up and running again (with a DB password this time).

Thanks for your help.
atrol
Site Admin
Posts: 8366
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Problems installing Mantis 2.7.0 on Ubuntu 16.04 with PH

Post by atrol »

Thanks for providing the solution.
Please use Search before posting and read the Manual
Post Reply