宝塔 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扩展

第三步:大功告成

相关推荐
宝桥南山6 小时前
.NET10 - 尝试一下Blazor Web Assembly Standalone App的fingerprint新特性
microsoft·微软·c#·asp.net·.net·.netcore
LoveXming16 小时前
Chapter14—中介者模式
c++·microsoft·设计模式·中介者模式·开闭原则
Elastic 中国社区官方博客1 天前
如何在 Azure 虚拟机上部署 Elasticsearch
大数据·人工智能·elasticsearch·microsoft·搜索引擎·全文检索·azure
FreeBuf_1 天前
微软全球服务中断:Azure、365、Xbox及Minecraft等多平台受影响
microsoft·azure·xbox
Poseidon、1 天前
2025年10月AI科技领域周报(10.20-10.26):多模态技术突破 具身智能开启机器人新纪元
人工智能·microsoft·机器人
不老刘2 天前
Microsoft 365 Copilot 扩展至应用和工作流构建功能
microsoft·copilot·ai编程
许泽宇的技术分享2 天前
当 AI Agent 遇上工作流编排:微软 Agent Framework 的 Workflow 深度解析
人工智能·microsoft
ManageEngine卓豪2 天前
Azure 监控工具怎么选?从原生局限到第三方解决方案的效率跃升
microsoft·azure·apm·azure监控
许泽宇的技术分享2 天前
当 AI Agent 遇上 MCP:微软 Agent Framework 的“瑞士军刀“式扩展之道
人工智能·microsoft
Leinwin2 天前
微软重磅发布开源引擎Microsoft Agent Framework
microsoft·开源