Skip to content

Instantly share code, notes, and snippets.

@vozhukh
Created December 29, 2016 08:02
Show Gist options
  • Save vozhukh/0b822429211f287d2a4c46dfbcb094b5 to your computer and use it in GitHub Desktop.
Save vozhukh/0b822429211f287d2a4c46dfbcb094b5 to your computer and use it in GitHub Desktop.
bitrix php7 erroc connec to mysql
<?
//Помилка:
/*
2016-12-25 10:13:52 - Host: host:80 - UNCAUGHT_EXCEPTION - [Error]
Call to undefined function Bitrix\Main\DB\mysql_connect() (0)
/home/bitrix/www/bitrix/modules/main/lib/db/mysqlconnection.php:45
#0: Bitrix\Main\DB\MysqlConnection->connectInternal()
/home/bitrix/www/bitrix/modules/main/lib/db/mysqlconnection.php:103
#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/sport/index.php:2
#13: include_once(string)
/home/bitrix/www/bitrix/modules/main/include/urlrewrite.php:159
#14: include_once(string)
/home/bitrix/www/bitrix/urlrewrite.php:2
*/
!!!Рішення:
#
Замінити # в bitrix/.settings.php
'className' => '\\Bitrix\\Main\\DB\\MysqlConnection',
на
'className' => '\\Bitrix\\Main\\DB\\MysqliConnection',
# та bitrix/php_interface/dbconn.php
Добавити:
define( "BX_USE_MYSQLI" , true);
Перевірити щоб був встановлений модуль - php-mysqlnd:
# rpm -qa | grep mysqlnd
php-mysqlnd-7.0.6-3.el6.remi.x86_64
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment