System uses MysqlManager.php instead of MysqliManager.php

We run SuiteCRM v7.10.14 on PHP v7.2 with PHP-FPM disabled and MariaDB v10.1.

For some reason, it appears the system is using /include/database/MysqlManager.php instead of /include/database/MysqliManager.php and crashes each time we install an update package.

The solution is to update the functions on this file to mysqli_* each time an update package is installed.

Any suggestions on how to resolve this permanently, would be appreciated.

Can’t you fix your PHP configuration to use MySqli?

Which Linux are you running?

Check your PHP modules in php.ini

We run EasyApache 4 on the latest WHM v78.

php72-php-mysqlnd is enabled which includes mysqli and it’s also enabled on phpinfo().

All settings are mainly stock so i wouldn’t expect to require a customisation on php.ini.

It looks to me as if Suite doesn’t pick the right version for some reason, or doesn’t realise mysqli is there and defaults to mysql

This is really not a SuiteCRM issue, it is a web server configuration issue. You should have only the extensions that work enabled.

Check Admin / Diagnostic / phpinfo to see what is enabled, and to see the location of your effective php.ini file. Then go there and disable what you don’t want SuiteCRM to see.

Hi again, possibly i didn’t make myself clear before.

MySQL is not enabled on our configuration. MySQLi and PDO_MySQL are enabled, but Suite is using the MysqlManager.php instead.

I imagine Suite is doing something clever to decide which file to use, but it fails on WHM with EasyApache 4.

  1. Can you point me to the file that makes this decision?
  2. Is there a config value i can use to force Suite to pick the right file?

What I mean is - after over 9000 posts here, it is the first time I see this sort of confusion. So I would say that SuiteCRM’s logic for this is highly tested and should really work, and hasn’t been changed recently.

What I do frequently see here is people who think they have one thing configured and in reality have another, because PHP configurations are tricky, involve two PHP’s (CLI and web server), and sometimes hostings do weird things to php.ini files.

Hence my advice:

Let’s check if your configuration is effective in the way that you think it is. I am obviously not suspecting you, I am just trying to diagnose objectively and then we’ll take it from there.

Anyway, to answer your request for pointers, you could have a look in your config.php (dbconfig array), the same in config_override, if present, and you can see the code at these places

https://github.com/salesagility/SuiteCRM/search?q=my_db_manager&unscoped_q=db_manager
https://github.com/salesagility/SuiteCRM/search?q=my_db_manager&unscoped_q=my_db_manager

Good luck, and tell us what you find. Thanks.

On the code you linked, MysqlManager loads if

$sugar_config['mysqli_disabled']

is empty and the mysqli_connect function exists.

In our case, mysqli_connect exists and mysql_connect doesn’t as it was removed in PHP 7.0.0

Looking at config.php i have the following


'dbconfig' => 
  array (
    'db_host_name' => 'localhost',
    'db_host_instance' => 'SQLEXPRESS',
    'db_user_name' => '',
    'db_password' => '',
    'db_name' => '',
    'db_type' => 'mysql',
    'db_port' => '',
    'db_manager' => 'MysqlManager',
  ),
  'dbconfigoption' => 
  array (
    'persistent' => true,
    'autofree' => false,
    'debug' => 0,
    'ssl' => false,
  ),

but even if i change them to mysqli, i get the same issue

The code falls to https://github.com/salesagility/SuiteCRM/blob/ef1b41965c056937894dd3018d3b149c9c25a9a9/include/database/DBManagerFactory.php#L103-L105

if i echo $my_db_manager on line 106, i get MysqliManager which is correct, but if i rename MysqlManager.php Suite still crashes, meaning it’s still required.

Removing ‘db_manager’ => ‘MysqlManager’, still gives me MysqliManager but removing MysqlManager.php has the same effect

This is what I have

  'dbconfig' =>
  array (
    'db_host_name' => 'localhost',
    'db_host_instance' => 'SQLEXPRESS',
    'db_user_name' => 'root',
    'db_password' => '******',
    'db_name' => 'suitecrm',
    'db_type' => 'mysql',
    'db_port' => '',
    'db_manager' => 'MysqliManager',
  ),

Note that you should have the “i” in db_manager, but the db_type is simply “mysql” (don’t add an “i” there!)

I run the latest update today from 7.10.14 to 7.10.15 having changed ‘db_manager’ to ‘MysqliManager’ and while running my customised MysqlManager.php and the system was working fine after that, so either something was fixed on the latest version or your change solved the issue.

Either way the issue seems to be resolved now, so thanks for your help