Rootop 服务器运维与web架构

解决 cannot find freeTDS in known installation directories 及 spprintf.h:40: note: expected ‘char **’ but argument is of type ‘unsigned char 错误

| 暂无评论

编译安装mssql模块提示错误:

cannot find freeTDS in known installation directories

看错误提示说是找不到freetds,安装freetds。当前版本为freetds-0.91


[root@mail ~]#wget -c ftp://ftp.freetds.org/pub/freetds/stable/freetds-stable.tgz
[root@mail freetds-0.91]# ./configure --prefix=/usr/local/freetds --with-tdsver=7.1
有的资料说是8.0 可是帮助里没有8.0版本,或者直接省略此参数--with-tdsver
[root@mail freetds-0.91]#make && make install

其实安装完freetds,编译mssql的时候这里出现了一个bug。编译报错:

/root/soft/php-5.3.3/ext/mssql/php_mssql.h:68: error: redefinition of typedef ‘LPBYTE’
/usr/local/freetds//include/sqlfront.h:36: note: previous declaration of ‘LPBYTE’ was here
/root/soft/php-5.3.3/ext/mssql/php_mssql.c: In function ‘php_mssql_do_connect’:
/root/soft/php-5.3.3/ext/mssql/php_mssql.c:760: warning: cast from pointer to integer of different size
/root/soft/php-5.3.3/ext/mssql/php_mssql.c: In function ‘php_mssql_get_column_content_without_type’:
/root/soft/php-5.3.3/ext/mssql/php_mssql.c:1105: warning: passing argument 1 of ‘spprintf’ from incompatible pointer type
/usr/include/php/main/spprintf.h:40: note: expected ‘char **’ but argument is of type ‘unsigned char **’
make: *** [php_mssql.lo] Error 1

在这里需要修改freetds源码,修改文件 freetds-0.91/include/sqlfront.h
找到 typedef       BYTE *  LPBYTE;  将其注释掉
/* typedef       BYTE *  LPBYTE; */

删除掉/usr/local/freetds后,重新编译安装 freetds 后再次编译mssql。


[root@mail mssql]# ./configure --with-mssql=/usr/local/freetds && make && make install

模块位于/usr/lib64/php/modules/下。配置php.ini加载即可。

原创文章,转载请注明。本文链接地址: https://www.rootop.org/pages/1669.html

作者:Venus

服务器运维与性能优化

发表回复