PHP 7.0 on Ubuntu 16 - pdo_mysql.so:未定义的符号:mysqlnd_connect

PHP 7.0 on Ubuntu 16 - pdo_mysql.so: undefined symbol: mysqlnd_connect

我正在处理这个 PDOException could not find driver

这是我的 /etc/php/7.0/apache2/php.ini 文件

;extension=php_bz2.dll
extension=php_curl.dll
extension=php_fileinfo.dll
;extension=php_ftp.dll
;extension=php_gd2.dll
;extension=php_gettext.dll
;extension=php_gmp.dll
extension=php_intl.dll
;extension=php_imap.dll
;extension=php_interbase.dll
;extension=php_ldap.dll
extension=php_mbstring.dll
;extension=php_exif.dll      ; Must be after mbstring as it depends on it
;extension=php_mysqli.dll
;extension=php_oci8_12c.dll  ; Use with Oracle Database 12c Instant Client
;extension=php_openssl.dll
;extension=php_pdo_firebird.dll
extension=php_pdo_mysql.dll
;extension=php_pdo_oci.dll
;extension=php_pdo_odbc.dll
;extension=php_pdo_pgsql.dll
extension=php_pdo_sqlite.dll
;extension=php_pgsql.dll
;extension=php_shmop.dll

当我 运行 php 在我的服务器中时,我收到此警告 PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/pdo_mysql.so' - /usr/lib/php/20151012/pdo_mysql.so: undefined symbol: mysqlnd_connect in Unknown on line 0

我必须确保 /usr/lib/php/20151012/mysqlnd.so 存在并且我的模块已被 /etc/php/7.0/mods-available 目录启用,有多个 .ini 文件,除了 mysqlnd.ini

所以我创建了它

sudo nano mysqlnd.ini

并把这个内容:

; configuration for php common module
; priority=10
extension=mysqlnd.so

重启apache

sudo service apache2 restart