繁体   English   中英

无法在 ubuntu 14.04 上为 php5.6 安装 sqlsrv 库

[英]Cannot install sqlsrv library for php5.6 on ubuntu 14.04

如何安装此库以使用我的 php5.6 连接到 mssql 2012?

更新:我发现 3.0.1 版是正确的版本(如果我错了,请纠正我)。

但是现在,我收到此错误:

pecl install sqlsrv-3.0.1    
downloading sqlsrv-3.0.1.tgz ...
Starting to download sqlsrv-3.0.1.tgz (134,966 bytes)
.............................done: 134,966 bytes
17 source files, building
running: phpize
Cannot find config.m4.
Make sure that you run '/usr/bin/phpize' in the top level source directory of the module

ERROR: `phpize' failed

更新:当我尝试手动安装文件时,顶级目录不包含 config.m4。 它只包含 config.w32... 我该怎么办?

在 CentOS 7 上遇到同样的问题。来自 pecl.php.net 的存档中不存在文件 config.m4(版本 3.0.1,在 4.0.4 文件中存在,但至少需要 php7.0)。 我认为这个模块不适用于 linux php 5 版本。 最好编译 mssql 模块。

这就是为什么我从https://museum.php.net下载完整的 php 存档(在我的例子中是 - php-5.6.40.tar.xz)并从中编译 mssql

cd /tmp/
wget https://museum.php.net/php5/php-5.6.40.tar.gz
tar xvf php-5.6.40.tar.gz
cd php-5.6.40/ext/mssql/
/opt/php56/bin/phpize (in your case path to php5.6 phpize can be different)
yum install autoconf (on ubuntu package can have different name)
yum install freetds freetds-devel freetds-libs freetds (required to compile)
ln -s /usr/lib64/libsybdb.so /usr/lib/libsybdb.so (compiling search for libsybdb.so in /usr/lib/libsybdb.so but file was in  /usr/lib64/libsybdb.so that why i create symlink)
./configure --with-php-config=/opt/php56/bin/php-config (in your case path to php5.6 php-config can be different)
make

我用我的 php5.6 配置得到了 mssql 模块

/tmp/php-5.6.40/ext/mssql/modules/mssql.so

并且可以在 php.ini 中轻松地将它连接到我的 php56

您可以像这样安装特定版本: pecl install sqlsrv-4.3.0

您必须在此处浏览更改日志以找到您需要的版本。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM