Answer the question
In order to leave comments, you need to log in
When transferring, it does not want to connect to the database, what could be the problem?
I transfer opencart to a new host and does not want to connect to the database, this is what it says:
Warning: mysqli::__construct(): (HY000/2002): No such file or directory in /home/kirby/kirby-center.ru/docs/system/library/db/mysqli.php on line 7
Warning: DB\MySQLi::__construct(): Couldn't fetch mysqli in /home/kirby/kirby-center.ru/docs/system/library/db/mysqli.php on line 10
Warning: DB\MySQLi::__construct(): Couldn't fetch mysqli in /home/kirby/kirby-center.ru/docs/system/library/db/mysqli.php on line 10
Fatal error: Uncaught Exception: Error: <br />Error No: in /home/kirby/kirby-center.ru/docs/system/library/db/mysqli.php:10 Stack trace: #0 /home/kirby/kirby-center.ru/docs/system/library/db.php(9): DB\MySQLi->__construct('localhost', 'ЗДЕСЬ ЮСЕР', 'ЗДЕСЬ ПАРОЛЬ', 'ЗДЕСЬ БД', NULL) #1 /home/kirby/kirby-center.ru/docs/system/config/catalog.php(27): DB->__construct('mysqli', 'localhost', 'ЗДЕСЬ ЮСЕР', 'ЗДЕСЬ ПАРОЛЬ', 'ЗДЕСЬ БД') #2 /home/kirby/kirby-center.ru/docs/system/storage/modification/system/library/config.php(23): require('/home/kirby/kir...') #3 /home/kirby/kirby-center.ru/docs/system/framework.php(8): Config->load('catalog') #4 /home/kirby/kirby-center.ru/docs/system/startup.php(105): require_once('/home/kirby/kir...') #5 /home/kirby/kirby-center.ru/docs/index.php(19): start('catalog') #6 {main} thrown in /home/kirby/kirby-center.ru/docs/system/library/db/mysqli.php on line 10
define('DB_DRIVER', 'mysqli');
define('DB_HOSTNAME', 'localhost');
define('DB_USERNAME', 'ЗДЕСЬ ИМЯ');
define('DB_PASSWORD', 'ЗДЕСЬ ПАРОЛЬ');
define('DB_DATABASE', 'ЗДЕСЬ ДБ');
define('DB_PORT', '3306');
define('DB_PREFIX', 'oc_');
Answer the question
In order to leave comments, you need to log in
I transfer opencart to a new host and does not want to connect to the database, this is what it says:
First of all, pay attention to this :Why don't you have this file? Where did he go? I think it's worth checking out.No such file or directory in /home/kirby/kirby-center.ru/docs/system/library/db/mysqli.php on line 7
The second important point - did you compare the minimum PHP version for your version of OpenCart and the one that is on some ("new" or any other final) hosting?
what is in this variable _ENV["SCRIPT_FILENAME"] ?
and replace with new values of these constants
// HTTP
define('HTTP_SERVER', 'http://oc-store.vl/');
// HTTPS
define('HTTPS_SERVER', 'http://oc-store.vl/');
// DIR
define('DIR_APPLICATION', 'D:/OpenServer/domains/oc-store.vl/catalog/');
define('DIR_SYSTEM', 'D:/OpenServer/domains/oc-store.vl/system/');
define('DIR_IMAGE', 'D:/OpenServer/domains/oc-store.vl/image/');
define('DIR_LANGUAGE', 'D:/OpenServer/domains/oc-store.vl/catalog/language/');
define('DIR_TEMPLATE', 'D:/OpenServer/domains/oc-store.vl/catalog/view/theme/');
define('DIR_CONFIG', 'D:/OpenServer/domains/oc-store.vl/system/config/');
define('DIR_CACHE', 'D:/OpenServer/domains/oc-store.vl/system/storage/cache/');
define('DIR_DOWNLOAD', 'D:/OpenServer/domains/oc-store.vl/system/storage/download/');
define('DIR_LOGS', 'D:/OpenServer/domains/oc-store.vl/system/storage/logs/');
define('DIR_MODIFICATION', 'D:/OpenServer/domains/oc-store.vl/system/storage/modification/');
define('DIR_UPLOAD', 'D:/OpenServer/domains/oc-store.vl/system/storage/upload/');
Although the question was asked more than 2 years ago, I will answer for others looking for information, because. I faced this problem myself.
1. Look at DB_HOSTNAME. If the MySQL server is physically located on the same server as PHP, then localhost is written here, if on another, we write the IP of another server. After that, the error usually disappears.
2. When setting localhost, then mysqli tries to work with mysql via socket, not TCP/IP. In this case, we look at what phpinfo () gives out for the server in terms of mysqli settings and look at which socket is registered in the settings. We compare this setting with the setting in my.cfg mysql server. The socket must be the same in both mysql and php.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question