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

时间:2019-03-21 14:55:11

标签: pdo ubuntu-16.04 php-7.0

我很喜欢这个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

1 个答案:

答案 0 :(得分: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