Error could not load database driver mysqli

I have downloaded opencart 2.0 yesterday for testing it and after I installed vqmod latest 2.4.1 I started receiving the error Error: Could not load database driver mysqli!. I searched regarding this

I have downloaded opencart 2.0 yesterday for testing it and after I installed vqmod latest 2.4.1 I started receiving the error Error: Could not load database driver mysqli!. I searched regarding this error and found something related to the leading slash, but after I got an error like ‘Notice: Error: Could not load class Config.php!’. Current config.php

define('HTTP_SERVER', 'http://localhost/opencart/affiliate-payments/');

// HTTPS
define('HTTPS_SERVER', 'http://localhost/opencart/affiliate-payments/');

// DIR
define('DIR_APPLICATION', 'F:/SERVER/htdocs/opencart/affiliate-payments/catalog/');
define('DIR_SYSTEM', 'F:/SERVER/htdocs/opencart/affiliate-payments/system/');
define('DIR_LANGUAGE', 'F:/SERVER/htdocs/opencart/affiliate-payments/catalog/language/');
define('DIR_TEMPLATE', 'F:/SERVER/htdocs/opencart/affiliate-payments/catalog/view/theme/');
define('DIR_CONFIG', 'F:/SERVER/htdocs/opencart/affiliate-payments/system/config/');
define('DIR_IMAGE', 'F:/SERVER/htdocs/opencart/affiliate-payments/image/');
define('DIR_CACHE', 'F:/SERVER/htdocs/opencart/affiliate-payments/system/cache/');
define('DIR_DOWNLOAD', 'F:/SERVER/htdocs/opencart/affiliate-payments/system/download/');
define('DIR_MODIFICATION', 'F:/SERVER/htdocs/opencart/affiliate-payments/system/modification/');
define('DIR_LOGS', 'F:/SERVER/htdocs/opencart/affiliate-payments/system/logs/');

In the current configuration I get Error: Could not load database driver mysqli!

If I remove also the slash, like if I remove entirely F:/SERVER/htdocs/opencart/affiliate-payments/
I get same error Error: Could not load database driver mysqli!

if I remove F:/SERVER/htdocs/opencart/affiliate-payments I get Notice: Error: Could not load class Config.php! in F:SERVERhtdocsopencartaffiliate-paymentssystemstartup.php on line 74

Based on the persistent error, the issue (in my mind) comes down to one of a few cases:

  1. php-mysql is not installed, or is not the correct version for PHP 7.4
  2. The php-mysqlnd helper package is not installed (this generally comes with php-mysql, so should not require attention)
  3. Apache has not been restarted since updating PHP
  4. The mysqli extension is commented out in its ini file

So, let’s do some testing by creating a dummy PHP file in your web root that calls the phpinfo() function:

  1. Open Terminal (if it’s not already open)
  2. Create a dummy PHP file in the web root:
    sudo vi /var/www/testing.php
    

    Notes:
    Feel free to use any other editor that you prefer. The use of vi is more about muscle memory than an implicit endorsement for the editor.
    Be sure to change /var/www to the actual document root location for http://localhost

  3. Paste this into the new file:
    <?php phpinfo(); ?>
    
  4. Save the file
  5. Open your browser and access http://localhost/testing.php. This should give you a PHP information page that looks something like this:
    PHP Information
  6. Scroll down (or use the Find function) to locate the section titled mysqli. It should look something like this:
    PHP Info - MySQLi

Now comes the «fun» part.

If you see a blank page when visiting testing.php
⇢ PHP is not configured correctly. For simplicity’s sake, remove and re-install:

sudo apt install --reinstall php libapache2-mod-php php-mysql

Then restart Apache:

sudo service apache2 restart

If you see the PHP Info page, but nothing for mysqli …
mysqli is either not installed or not configured correctly.

  • Confirm that mysqli for PHP 7.4 is installed by opening a terminal (or using the current one) and typing sudo apt install php7.4-mysql (Note that we are specifically calling the package for 7.4 here. This should not be necessary, but we want to be 100% certain it’s the correct version for your PHP installation)

    If everything is installed properly, you will see a message like this:

    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    php7.4-mysql is already the newest version (7.4.3-4ubuntu2.4).
    0 to upgrade, 0 to newly install, 0 to remove and 2 not to upgrade.
    
  • Confirm that the mysqli.ini file exists and is configured correctly by opening a terminal (or using the one that’s currently open), navigating to the conf.d directory for PHP and Apache, and listing MySQL-related files:

    cd /etc/php/7.4/apache2/conf.d
    ll *mysql*
    

    You should see something like this:

    lrwxrwxrwx 1 root root 39  5月  9  2020 10-mysqlnd.ini -> /etc/php/7.4/mods-available/mysqlnd.ini
    lrwxrwxrwx 1 root root 38  5月  9  2020 20-mysqli.ini -> /etc/php/7.4/mods-available/mysqli.ini
    lrwxrwxrwx 1 root root 41  5月  9  2020 20-pdo_mysql.ini -> /etc/php/7.4/mods-available/pdo_mysql.ini
    

    If you do not see these files, then php-mysql was not correctly installed. Let’s try again:

    sudo apt install --reinstall php-mysql
    

    Open the 20-mysqli.ini file and ensure the contents of the file matches this:

    ; configuration for php mysql module
    ; priority=20
    extension=mysqli.so
    

    Restart Apache:

    sudo service apache2 restart
    

    If everything matches, open the mysqlnd.ini file. This file must be loaded before mysqli, so it will probably be prefixed with 10- in the directory. Ensure the extension=mysqlnd.so line does not have a ; in front of it.

If everything so far has matched your configuration …
⇢ The problem is most likely in the application code itself and may need to be examined by a developer familiar with the system to make the changes necessary to work with the newer technology stack.

Rarely do I see Apache installations require this much effort unless you’re migrating something with really obscure requirements. Most LAMP stacks are painfully simple, as a lot of people have made the tools a lot easier to use over the last decade or so.

Hopefully something here will help you resolve the issue.

I followed the trino tutorial and started superset with the Docker Compose of the latest git repository.
And now i get always the error:

ERROR: Could not load database driver: TrinoEngineSpec

Expected results

I have access to trino database

Actual results

Error Message

How to reproduce the bug

  1. Clone git repo
  2. Add sqlalchemy-trino to requirements-local.txt (https://superset.apache.org/docs/databases/dockeradddrivers)
  3. Execute «docker-compose -f docker-compose-non-dev.yml up»
  4. Add trino://{username}:{password}@{hostname}:{port}/{catalog} to database and see error

Environment

(please complete the following information):

  • superset version: docker version: latest
  • python version: python --version
    Python 3.7.9
    Flask 1.1.2
    Werkzeug 1.0.1

Checklist

Make sure to follow these steps before submitting your issue — thank you!

  • I have checked the superset logs for python stacktraces and included it here as text if there are any.
  • I have reproduced the issue with at least the latest released version of superset.
  • I have checked the issue tracker for the same issue and I haven’t found one similar.

Additional context

pip freeze output of worker:
simplejson==3.17.2
six==1.15.0
slackclient==2.5.0
SQLAlchemy==1.3.20
sqlalchemy-trino==0.2.0
SQLAlchemy-Utils==0.36.8
sqlparse==0.3.0
tableschema==1.20.0
tabulator==1.52.5
thrift==0.13.0
thrift-sasl==0.4.2
trino==0.305.0

Понравилась статья? Поделить с друзьями:
  • Error could not install packages due to an environmenterror winerror 5
  • Error could not insert vboxdrv exec format error
  • Error could not insert floppy
  • Error could not initialize webview telegram
  • Error could not initialize webgl перевод