Ubuntu 20.04 中 MSSQL 的 PHP 驱动程序

标签 php sql-server ubuntu

我在 docker 上运行 Ubuntu 20.04。现在我需要使用 PHP 连接到远程 MSSQL 服务器。按照 Microsoft 和各个网站的说明安装 PHP 驱动程序后,我仍然收到以下错误:

PDOException: SQLSTATE[IMSSP]: This extension requires the Microsoft ODBC Driver for SQL Server to communicate with SQL Server. Access the following URL to download the ODBC Driver for SQL Server for x64: https://go.microsoft.com/fwlink/?LinkId=163712 in /root/getDbStatus.php:15
我安装了sqlsrvpdo_sqlsrv使用 pecl命令,将扩展 ini 添加到 /etc/php/7.4/mods-available/手动,并创建到 /etc/php/7.4/cli/conf.d/ 的软链接(soft link).
enter image description here
enter image description here
enter image description here
以下是一些包信息。
enter image description here
enter image description here从 phpinfo() 打印。
我还注意到我的 odbc 驱动程序文件实际上是空的,我不知道为什么会这样。
enter image description here
我在这里错过了什么吗?

最佳答案

好的。我在这里找到了我错过的东西。
除了 unixodbc-dev包,我还需要安装msodbcsql17 .
enter image description here
感谢大家的时间。

关于Ubuntu 20.04 中 MSSQL 的 PHP 驱动程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69069704/

相关文章:

php - 显示 "”"的正确字符编码?

php - 内部 gd 字体 () 不可用仅使用 1-5

c# - 为多行 SQL 创建唯一 ID

sql-server - SQL Server 2019 : 'Microsoft.ACE.OLEDB.16.0' provider is not registered on the local machine. (System.Data)

sql - 测试时我想在变量中插入多个值

shell - Ubuntu 20.04 获取 shell 非常慢

python - IE 测试的 Selenium 问题

JDK 1.8 或更高版本与 Cordova 的 Java 11 要求检查失败

php - 在 Ubuntu 服务器上部署 Laravel Vue 后 POST 路由不起作用

php - 这个签名在 PHP 中是什么意思 (&)?