skip to Main Content

I make some PHP applications and use PDO.
Everything is fine until I remove –purge PHP 7.2 and install PHP 7.4.

The program is running but says "could not find driver".

Install all modules like usual, and have error like this in Ubuntu :

Command:

#php -v

Result :

PHP Warning:  PHP Startup: Unable to load dynamic library 'pdo_mysql.so' (tried: /usr/lib/php/20190902/pdo_mysql.so (/usr/lib/php/20190902/pdo_mysql.so: undefined symbol: mysqlnd_allocator), /usr/lib/php/20190902/pdo_mysql.so.so (/usr/lib/php/20190902/pdo_mysql.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP 7.4.16 (cli) (built: Mar  5 2021 07:54:20) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.16, Copyright (c), by Zend Technologies

Command:

# php -i |grep PDO

Result :

PHP Warning:  PHP Startup: Unable to load dynamic library 'pdo_mysql.so' (tried: /usr/lib/php/20190902/pdo_mysql.so (/usr/lib/php/20190902/pdo_mysql.so: undefined symbol: mysqlnd_allocator), /usr/lib/php/20190902/pdo_mysql.so.so (/usr/lib/php/20190902/pdo_mysql.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PDO
PDO support => enabled
PDO drivers => mysql, pgsql, sqlite
PDO Driver for MySQL => enabled
PDO Driver for PostgreSQL => enabled
PDO Driver for SQLite 3.x => enabled

In my info.php

Loaded Configuration File   /etc/php/7.4/fpm/php.ini

In my terminal

Loaded Configuration File => /etc/php/7.4/cli/php.ini

So I edited in /etc/php/7.4/cli/php.ini.
Is I am wrong? Can someone give me a suggestion? Thanks.

2

Answers


  1. Chosen as BEST ANSWER

    The real one is shown by info.php:

    Loaded Configuration File   /etc/php/7.4/fpm/php.ini
    

    So, I finished the issue with configuring php.ini in fpm.


  2. I fixed this issue by making sure I had the package installed: sudo apt-get install php7.4-mysql

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search