无法使用mysqli扩展编译PHP 5.2

内容来源于 Stack Overflow,并遵循CC BY-SA 3.0许可协议进行翻译与使用

  • 回答 (2)
  • 关注 (0)
  • 查看 (241)

我用mysql扩展mysqli编译PHP 5.2版

吼叫是步骤

  1. 配置

sudo ./configure --with-mysqli = / opt / mysql / server-5.1 / bin / mysql_config

[它工作正常的mysql版本是5.1我也尝试了最新]

  1. 使

使

[在我发现后发出吼叫错误]

-lmysqlclient -lz -lcrypt -lnsl -lm -lxml2 -lcrypt -lxml2 -lxml2 -lxml2 -lcrypt -o sapi/cgi/php-cgi ext/mysqli/mysqli_repl.o: In function zif_mysqli_disable_reads_from_master': /usr/local/src/php5-build/php-5.2.5/ext/mysqli/mysqli_repl.c:43: undefined reference tomysql_disable_reads_from_master' ext/mysqli/mysqli_repl.o: In function zif_mysqli_disable_rpl_parse': /usr/local/src/php5-build/php-5.2.5/ext/mysqli/mysqli_repl.c:59: undefined reference tomysql_disable_rpl_parse' ext/mysqli/mysqli_repl.o: In function zif_mysqli_enable_reads_from_master': /usr/local/src/php5-build/php-5.2.5/ext/mysqli/mysqli_repl.c:76: undefined reference tomysql_enable_reads_from_master' ext/mysqli/mysqli_repl.o: In function zif_mysqli_enable_rpl_parse': /usr/local/src/php5-build/php-5.2.5/ext/mysqli/mysqli_repl.c:93: undefined reference tomysql_enable_rpl_parse' ext/mysqli/mysqli_repl.o: In function zif_mysqli_master_query': /usr/local/src/php5-build/php-5.2.5/ext/mysqli/mysqli_repl.c:111: undefined reference tomysql_master_query' ext/mysqli/mysqli_repl.o: In function zif_mysqli_rpl_parse_enabled': /usr/local/src/php5-build/php-5.2.5/ext/mysqli/mysqli_repl.c:130: undefined reference tomysql_rpl_parse_enabled' ext/mysqli/mysqli_repl.o: In function zif_mysqli_rpl_probe': /usr/local/src/php5-build/php-5.2.5/ext/mysqli/mysqli_repl.c:147: undefined reference tomysql_rpl_probe' ext/mysqli/mysqli_repl.o: In function zif_mysqli_rpl_query_type': /usr/local/src/php5-build/php-5.2.5/ext/mysqli/mysqli_repl.c:168: undefined reference tomysql_rpl_query_type' ext/mysqli/mysqli_repl.o: In function zif_mysqli_slave_query': /usr/local/src/php5-build/php-5.2.5/ext/mysqli/mysqli_repl.c:207: undefined reference tomysql_slave_query' collect2: ld returned 1 exit status make: * [sapi / cgi / php-cgi]错误1

请让我知道解决方案

提问于
用户回答回答于

我已经运行了这个命令

sudo ./configure --disable-all --with-mysql = / opt / mysql / server-5.1 / --with-mysqli = / opt / mysql / server-5.1 / bin / mysql_config

它在我以前的命令中工作我错过了/opt/mysql/server-5.1/

用户回答回答于

我的猜测是你的MySQL头文件来自错误版本的MySQL客户端。您尝试与PHP 5.2一起构建的php-mysql扩展已超过5年,并且需要来自相应MySQL版本的库和头文件。只是做'apt-get install mysql-client mysql-client-dev'这样的东西会安装一个最新的版本,所以你可能需要下载一个旧版本并自己构建它并告诉./configure在哪里找到mysql头文件(类似./configure-with-mysqli = / path / to / old / headers)

编辑:请注意配置标志非常重要,否则您仍将包含错误的标头(基于您的系统包含路径)

扫码关注云+社区

领取腾讯云代金券

年度创作总结 领取年终奖励