sql-server - 消息 : This extension requires the Microsoft ODBC Driver 11 or 13 for SQL Server

标签 sql-server ubuntu

在最近更新到 Ubuntu 后使用 PHP 7.1 运行 Ubuntu 16 6 个月,在连接到 MS-SQL Server 时收到以下错误:

Error information: 
SQLSTATE: IMSSP
Code: -49
Message: This extension requires the Microsoft ODBC Driver 11 or 13 for SQL Server. Access the following URL to download the ODBC Driver 11 or 13 for SQL Server for x64: http://go.microsoft.com/fwlink/?LinkId=163712
SQLSTATE: IM002
Code: 0
Message: [unixODBC][Driver Manager]Data source name not found, and no default driver specified

示例代码:
*$serverName = "10.0.9.1";
$connectionOptions = array(
    "Database" => "db",
    "Uid" => "id",
    "PWD" => "pass"
);
//Establishes the connection
$conn = sqlsrv_connect( $serverName, $connectionOptions );*

尝试了全新安装并使用 PHP 7.2 相同的结果,但这里的 Linux 技能设置较低。

最佳答案

来自 New Microsoft ODBC Driver 17 breaks LAMP server

结果 php_sqlsrv 4.3.* (current stable) install 将尝试将 msodbcsql 更新到 17。问题是 php_sqlsrv 需要 5+ 才能与 msodbcsql 17 一起使用,但它没有发布为稳定版本。

冉:

sudo su 
curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list > /etc/apt/sources.list.d/mssql-release.list
exit
sudo ACCEPT_EULA=Y apt-get install msodbcsql=13.1.9.0-1 mssql-tools=14.0.6.0-1 unixodbc-dev

这解决了问题,再次更新将再次破坏它。

关于sql-server - 消息 : This extension requires the Microsoft ODBC Driver 11 or 13 for SQL Server,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48817027/

相关文章:

sql - 在新的数据库服务器上创建新的非对称 key 会导致旧数据失效吗?

Docker 服务启动失败

ubuntu - 如何审核 chrome 扩展的开源代码?

sql - 如何在 SQL Server Express 中安排脚本(无需 SQL Server 代理)?

sql-server - 通过 VB 代码向 SQL Server 存储过程添加参数时出错?

c# - 验证登录用户新输入的密码

c++ - SDL 不渲染(Linux、i3wm)

mongodb - E : Unable to locate package mongodb-org

ubuntu - 无法在 Samba Share 中打开 VScode

sql-server - 检查约束不允许我添加数据