宝塔 php支持sqlserver

PDOException: SQLSTATE[IMSSP]: This extension requires the Microsoft ODBC Driver for SQL Server to communicate with SQL Server.

错误原因

这是 PHP 试图连接 SQL Server 数据库,但缺少必要的 ODBC 驱动支持 导致的。

具体来说:

  • 你使用的是 PDO_SQLSRVsqlsrv 扩展;
  • 这些扩展需要底层依赖 Microsoft ODBC Driver for SQL Server
  • 当前环境中没有安装这个驱动;
  • 因此 PHP 无法与 SQL Server 建立连接。

第一步:安装 Microsoft ODBC Driver for SQL Serve

步骤 1:删除旧的仓库文件(如果存在)

rm -f /etc/yum.repos.d/mssql-release.repo

步骤 2:重新添加 Microsoft SQL Server 官方仓库 curl -o /etc/yum.repos.d/mssql-release.repo https://packages.microsoft.com/config/rhel/8/prod.repo

步骤 3:清理并更新 yum 缓存

https://packages.microsoft.com/config/rhel/8/prod.repo

dnf clean all

dnf makecache

步骤 4:安装 ODBC 驱动

sudo ACCEPT_EULA=Y dnf install -y msodbcsql17

验证安装

odbcinst -j

第二步:宝塔安装php扩展

第三步:大功告成

相关推荐
Dxy123931021620 小时前
报错:selenium.common.exceptions.ElementNotInteractableException: Message
selenium·测试工具·microsoft
yangrenrui1 天前
微软:科技领域的创新巨头
microsoft
GitHubDaily1 天前
微软发布了一款 AI 浏览器
人工智能·microsoft
筏.k1 天前
知识随记-----使用现代C++客户端库redis-plus-plus实现redis池缓解高并发
c++·经验分享·redis·microsoft
ALLSectorSorft2 天前
相亲小程序聊天与互动系统模块搭建
java·数据库·sql·microsoft·oracle
步、步、为营3 天前
.NET Core 3.1 升级到 .NET 8
microsoft·.net·.netcore
SBFE4 天前
出现错误,Microsoft store初始化失败。请尝试刷新或稍后返回。
microsoft
m0_720245014 天前
QT(四)基本组件
数据库·qt·microsoft
王柏龙5 天前
Entity Framework Core (EF Core) 中Database
数据库·microsoft