Ubuntu 18.04 + PHP7.3 - 无法加载动态库“pdo_mysql.so”。如何解决?

Ubuntu 18.04 + PHP7.3 - 无法加载动态库“pdo_mysql.so”。如何解决?

我已将 SO 从 Ubuntu 16.04 更新到 18.04。我使用 NGINX 作为服务器,并将 php 从 7.1 更新到 7.2 和 7.3。

现在当我php -v这样做时我得到了:

PHP Warning:  PHP Startup: Unable to load dynamic library 'pdo_mysql.so' (tried: /usr/lib/php/20180731/pdo_mysql.so (/usr/lib/php/20180731/pdo_mysql.so: undefined symbol: pdo_parse_params), /usr/lib/php/20180731/pdo_mysql.so.so (/usr/lib/php/20180731/pdo_mysql.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP 7.3.12-1+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Nov 28 2019 07:37:16) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.12, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.3.12-1+ubuntu18.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies

这是一个警告,但我无法加载例如php Artisan。以下是发生的情况:

$ php artisan
PHP Warning:  PHP Startup: Unable to load dynamic library 'pdo_mysql.so' (tried: /usr/lib/php/20180731/pdo_mysql.so (/usr/lib/php/20180731/pdo_mysql.so: undefined symbol: pdo_parse_params), /usr/lib/php/20180731/pdo_mysql.so.so (/usr/lib/php/20180731/pdo_mysql.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0

In Connection.php line 1262:

未找到“PDO”类

在文件里面/usr/lib/php/20180731我有pdo_mysql.so

/usr/lib/php/20180731$ ll
total 9340
drwxr-xr-x 3 root root    4096 Dec  4 22:31 ./
drwxr-xr-x 8 root root    4096 Dec  4 14:39 ../
drwxr-xr-x 2 root root    4096 Dec  4 14:29 build/
-rw-r--r-- 1 root root   30824 Nov 28 02:37 calendar.so
-rw-r--r-- 1 root root   14440 Nov 28 02:37 ctype.so
-rw-r--r-- 1 root root   92264 Nov 28 02:37 curl.so
-rw-r--r-- 1 root root  161896 Nov 28 02:37 dom.so
-rw-r--r-- 1 root root   84072 Nov 28 02:37 exif.so
-rw-r--r-- 1 root root 5425264 Nov 28 02:37 fileinfo.so
-rw-r--r-- 1 root root   59496 Nov 28 02:37 ftp.so
-rw-r--r-- 1 root root  104552 Nov 28 02:37 gd.so
-rw-r--r-- 1 root root   14440 Nov 28 02:37 gettext.so
-rw-r--r-- 1 root root   43112 Nov 28 02:37 iconv.so
-rw-r--r-- 1 root root   43112 Nov 28 02:37 json.so
-rw-r--r-- 1 root root 1595528 Nov 28 02:37 mbstring.so
-rw-r--r-- 1 root root  133224 Nov 28 02:37 mysqli.so
-rw-r--r-- 1 root root  247416 Nov 28 02:37 mysqlnd.so
-rw-r--r-- 1 root root  506352 Nov 28 02:37 opcache.so
-rw-r--r-- 1 root root   26728 Nov 28 02:37 pdo_mysql.so
-rw-r--r-- 1 root root  108648 Nov 28 02:37 pdo.so
-rw-r--r-- 1 root root  268392 Nov 28 02:37 phar.so
-rw-r--r-- 1 root root   34920 Nov 28 02:37 posix.so
-rw-r--r-- 1 root root   30824 Nov 28 02:37 readline.so
-rw-r--r-- 1 root root   14440 Nov 28 02:37 shmop.so
-rw-r--r-- 1 root root   51304 Nov 28 02:37 simplexml.so
-rw-r--r-- 1 root root   88168 Nov 28 02:37 sockets.so
-rw-r--r-- 1 root root   14440 Nov 28 02:37 sysvmsg.so
-rw-r--r-- 1 root root   10344 Nov 28 02:37 sysvsem.so
-rw-r--r-- 1 root root   14440 Nov 28 02:37 sysvshm.so
-rw-r--r-- 1 root root   18536 Nov 28 02:37 tokenizer.so
-rw-r--r-- 1 root root   30824 Nov 28 02:37 wddx.so
-rw-r--r-- 1 root root   30824 Nov 28 02:37 xmlreader.so
-rw-r--r-- 1 root root   47208 Nov 28 02:37 xml.so
-rw-r--r-- 1 root root   47208 Nov 28 02:37 xmlwriter.so
-rw-r--r-- 1 root root   30824 Nov 28 02:37 xsl.so
-rw-r--r-- 1 root root   63592 Nov 28 02:37 zip.so

这就是我所拥有的php -m

PHP Warning:  PHP Startup: Unable to load dynamic library 'pdo_mysql.so' (tried: /usr/lib/php/20180731/pdo_mysql.so (/usr/lib/php/20180731/pdo_mysql.so: undefined symbol: pdo_parse_params), /usr/lib/php/20180731/pdo_mysql.so.so (/usr/lib/php/20180731/pdo_mysql.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
[PHP Modules]
Core
curl
date
filter
gd
hash
json
libxml
mbstring
mysqli
mysqlnd
openssl
pcntl
pcre
readline
Reflection
session
sodium
SPL
standard
Zend OPcache
zip
zlib

[Zend Modules]
Zend OPcache

已经pdo_mysql解析 ( php -i)

Additional .ini files parsed => /etc/php/7.3/cli/conf.d/10-mysqlnd.ini,
/etc/php/7.3/cli/conf.d/10-opcache.ini,
/etc/php/7.3/cli/conf.d/20-curl.ini,
/etc/php/7.3/cli/conf.d/20-gd.ini,
/etc/php/7.3/cli/conf.d/20-json.ini,
/etc/php/7.3/cli/conf.d/20-mbstring.ini,
/etc/php/7.3/cli/conf.d/20-mysqli.ini,
/etc/php/7.3/cli/conf.d/20-pdo_mysql.ini,
/etc/php/7.3/cli/conf.d/20-readline.ini,
/etc/php/7.3/cli/conf.d/20-zip.ini

有任何线索知道如何解决这个问题吗?

相关内容