NOT A DUPLICATE - SEE SOLUTION IN EDIT AT THE BOTTOM
I've done my research and the solutions I've found haven't worked for me, not even the "duplicated" solution marked by the moderators, which has nothing to do with my problem
NOTE: I appreciate all the comments, but I can't just "change my code" as some suggest, this is Moodle, and it's supposed to work out of the box with PHP 7.2 and mysqli. It's either a problem of configuration that I'm missing or some bug that's making Moodle still use mysql even though I have it set up to use mysqli.
I've just upgraded a Moodle 3.2 site to Moodle 3.6. The upgrade process has seemingly gone fine, however I can't log into the site, I get the following error:
Exception - Call to undefined function mysql_connect()
The old site used to run on PHP 5.6, but I've upgraded the server's PHP 7.2 and installed all the required modules. I'm aware that on PHP 7 mysql has been deprecated, and following indications found online I've changed the dbtype to mysqli before the upgrade, as explained here: https://moodle.org/mod/forum/discuss.php?d=370774. I've made this change both in the site's admin area for the external enrolment plugin (before the Moodle upgrade) and in the database (after the upgrade).
I have also set $CFG->dbtype = 'mysqli';
in config.php.
After doing the Moodle upgrade, the site loads fine, until I try to login, when I get the aforementioned error. The site uses external database authentication for students, but the admin user is in the same database as Moodle (not in the external one).
Any ideas of how I can fix this? Looks like the error comes from Moodle insisting in using mysql instead of mysqli, but I don't know what else to change to prevent that... I've also purged caches and restarted db services to no avail.
This is the debug output when trying to login as an admin:
Debug info:
Error code: generalexceptionmessage
Stack trace:
line 461 of /lib/adodb/drivers/adodb-mysql.inc.php: Error thrown
line 492 of /lib/adodb/drivers/adodb-mysql.inc.php: call to ADODB_mysql->_connect()
line 667 of /lib/adodb/adodb.inc.php: call to ADODB_mysql->_nconnect()
line 867 of /enrol/database/lib.php: call to ADOConnection->Connect()
line 144 of /enrol/database/lib.php: call to enrol_database_plugin->db_init()
line 245 of /lib/enrollib.php: call to enrol_database_plugin->sync_user_enrolments()
line 486 of /lib/classes/session/manager.php: call to enrol_check_plugins()
line 4528 of /lib/moodlelib.php: call to core\session\manager::login_user()
line 199 of /login/index.php: call to complete_user_login()
EDIT (SOLUTION):
I can't post a solution because despite my requests this question keeps being locked, even though it's obviously not a duplicate, but I guess some are too proud... Anyways, since this may help someone else in the future, this is the solution:
The problem itself is that despite having changed the auth_db setting in the Site admin (Authentication Plugin -> External database) to mysqli, for some reason that wasn't getting updated in the database.
The solution has been to manually change that record in the database:
Table: mdl_config_plugins
Row: auth_db -> type set to mysqli