I
I
Ingvar Von Bjork2018-10-11 13:31:09
1C-Bitrix
Ingvar Von Bjork, 2018-10-11 13:31:09

How to set up a database connection?

I am deploying a site from a backup on Bitrix VM. The site is on PHP 5, PHP 7 is installed in the virtual machine. It seems that there should be no problems with the transfer.
When I try to enter the site, it says:

[Bitrix\Main\DB\ConnectionException] 
Mysql connect error [localhost, 127.0.0.1] (400)
/home/bitrix/www/bitrix/modules/main/lib/db/mysqlconnection.php:49
#0: Bitrix\Main\DB\MysqlConnection->connectInternal()
   /home/bitrix/www/bitrix/modules/main/lib/db/mysqlconnection.php:105
#1: Bitrix\Main\DB\MysqlConnection->queryInternal(string, array, NULL)
   /home/bitrix/www/bitrix/modules/main/lib/db/connection.php:329
#2: Bitrix\Main\DB\Connection->query(string)
   /home/bitrix/www/bitrix/modules/main/lib/config/option.php:182
#3: Bitrix\Main\Config\Option::load(string, NULL)
   /home/bitrix/www/bitrix/modules/main/lib/config/option.php:53
#4: Bitrix\Main\Config\Option::get(string, string, string)
   /home/bitrix/www/bitrix/modules/main/lib/httprequest.php:337
#5: Bitrix\Main\HttpRequest->prepareCookie(array)
   /home/bitrix/www/bitrix/modules/main/lib/httprequest.php:63
#6: Bitrix\Main\HttpRequest->__construct(object, array, array, array, array)
   /home/bitrix/www/bitrix/modules/main/lib/httpapplication.php:42
#7: Bitrix\Main\HttpApplication->initializeContext(array)
   /home/bitrix/www/bitrix/modules/main/lib/application.php:122
#8: Bitrix\Main\Application->initializeExtendedKernel(array)
   /home/bitrix/www/bitrix/modules/main/include.php:23
#9: require_once(string)
   /home/bitrix/www/bitrix/modules/main/include/prolog_before.php:14
#10: require_once(string)
   /home/bitrix/www/bitrix/modules/main/include/prolog.php:10
#11: require_once(string)
   /home/bitrix/www/bitrix/header.php:1
#12: require(string)
   /home/bitrix/www/index.php:2

The connection to the database is correct, at least in the console I connect using this login-password. What to do then?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
Bankir77, 2018-10-11
@Bankir77

You need to replace the extension with Mysqli in the configs, here is how to do it - https://dobrohost.ru/faq/bitrix-php7.html
At the same time, the Bitrix version must be at least 16.5

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question