Bitrix ошибка (Call to undefined function Bitrix\Main\DB\mysql_connect() (0))

30.08.2021

В процессе обновления Bitrix, с очень старой версии, Битрикс "порадовал" ошибкой (Call to undefined function Bitrix\Main\DB\mysql_connect() (0))

pic1

Решение:

  • В файл /bitrix/php_interface/dbconn.php добавляем:

     
    define("BX_USE_MYSQLI", true);
    

  • А в файле /bitrix/.settings.php поправляем MysqlConnection на MysqliConnection

     
    ...
     'connections' =>
     array (
       'value' =>
       array (
         'default' =>
         array (
           'className' => '\\Bitrix\\Main\\DB\\MysqliConnection',
           ...
         ),
       ),
     ),
    

Полный текст ошибки:

 
[Error] 
Call to undefined function Bitrix\Main\DB\mysql_connect() (0)
/var/www/SITE/public_html/bitrix/modules/main/lib/db/mysqlconnection.php:45
#0: Bitrix\Main\DB\MysqlConnection->connectInternal()
	/var/www/SITE/public_html/bitrix/modules/main/lib/db/mysqlconnection.php:103
#1: Bitrix\Main\DB\MysqlConnection->queryInternal(string, array, NULL)
	/var/www/SITE/public_html/bitrix/modules/main/lib/db/connection.php:330
#2: Bitrix\Main\DB\Connection->query(string)
	/var/www/SITE/public_html/bitrix/modules/main/lib/config/option.php:226
#3: Bitrix\Main\Config\Option::load(string, NULL)
	/var/www/SITE/public_html/bitrix/modules/main/lib/config/option.php:53
#4: Bitrix\Main\Config\Option::get(string, string, string)
	/var/www/SITE/public_html/bitrix/modules/main/lib/httprequest.php:370
#5: Bitrix\Main\HttpRequest->prepareCookie(array)
	/var/www/SITE/public_html/bitrix/modules/main/lib/httprequest.php:68
#6: Bitrix\Main\HttpRequest->__construct(object, array, array, array, array)
	/var/www/SITE/public_html/bitrix/modules/main/lib/httpapplication.php:46
#7: Bitrix\Main\HttpApplication->initializeContext(array)
	/var/www/SITE/public_html/bitrix/modules/main/lib/application.php:122
#8: Bitrix\Main\Application->initializeExtendedKernel(array)
	/var/www/SITE/public_html/bitrix/modules/main/include.php:23
#9: require_once(string)
	/var/www/SITE/public_html/bitrix/modules/main/include/prolog_before.php:14
#10: require_once(string)
	/var/www/SITE/public_html/bitrix/modules/main/include/prolog.php:10
#11: require_once(string)
	/var/www/SITE/public_html/bitrix/header.php:1
#12: require(string)
	/var/www/SITE/public_html/index.php:2


Категории: Bitrix CMS
Яндекс.Метрика