大网数据广告活动
服务器运维问答

PHP "mysqli.so: undefined symbol: mysqlnd_connect in Unknown on line 0"

· 52CE 我爱测

I have been trying to get PHP CLI (7.0.7 on Ubuntu) working together with mysqli, but without success. I keep getting the same error message when starting it: mysqli.so: undefined symbol: mysqlnd_connect in Unknown on line 0 This…

问题原文

原帖链接 · fgblomqvist · CC BY-SA 3.0

I have been trying to get PHP CLI (7.0.7 on Ubuntu) working together with mysqli, but without success. I keep getting the same error message when starting it:

mysqli.so: undefined symbol: mysqlnd_connect in Unknown on line 0

This is some of the output from php -i (clearly showing both were loaded):

mysqli

MysqlI Support => enabled
Client API library version => mysqlnd 5.0.12-dev - 20150407 - $Id: 241ae00989d1995ffcbbf63d579943635faf9972 $
Active Persistent Links => 0
Inactive Persistent Links => 0
Active Links => 0

Directive => Local Value => Master Value
mysqli.allow_local_infile => On => On
mysqli.allow_persistent => On => On
mysqli.default_host => no value => no value
mysqli.default_port => 3306 => 3306
mysqli.default_pw => no value => no value
mysqli.default_socket => no value => no value
mysqli.default_user => no value => no value
mysqli.max_links => Unlimited => Unlimited
mysqli.max_persistent => Unlimited => Unlimited
mysqli.reconnect => Off => Off
mysqli.rollback_on_cached_plink => Off => Off

mysqlnd

mysqlnd => enabled
Version => mysqlnd 5.0.12-dev - 20150407 - $Id: 241ae00989d1995ffcbbf63d579943635faf9972 $
Compression => supported
core SSL => supported
extended SSL => supported
Command buffer size => 4096
Read buffer size => 32768
Read timeout => 31536000
Collecting statistics => Yes
Collecting memory statistics => No
Tracing => n/a
Loaded plugins => mysqlnd,debug_trace,auth_plugin_mysql_native_password,auth_plugin_mysql_clear_password,auth_plugin_sha256_password
API Extensions => mysqli,pdo_mysql

PHP was installed using sudo apt install php7.0-cli.

What is wrong?

社区高分解答

原帖链接 · Jonathan King · CC BY-SA 3.0

When you load mysqli after mysqlnd, this solves the issue. BUT

if you use phpenmod to enable the modules they enable in alphabetical order. mysqli is before mysqlnd in the order.

I got around this by renaming the symlinks to mysqli to zmysqli - crude, but it worked.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-06-17)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。