dongmengan8620 2017-03-13 16:17
浏览 41
已采纳

无法在PHP中连接到SQL Server

I trying to connect to a MSSQL Server with PHP. For that I am using the following script:

function mssqli_connect($server,$username,$password,$database){
    $connectionInfo = array("Database"=>$database, "UID"=>$username, "PWD"=>$password);
    return sqlsrv_connect($server,$connectionInfo);
}

I am running PHP 7.0.7 on a Windows Server with the IIS 7.5. Unfortunately it doesn't work and I have no idea why.

What I've already tried

I dumped the function, but it only returns bool(false), which is not very helpful. I also tried to ping the server via cmd. This has succeeded. The credentials are also correct.

The extension php_sqlsrv_7_nts.dll is also requested in the php.ini, so it doesn't give me an error, that the function wasn't found.

Do I miss something, which is required?

  • 写回答

1条回答 默认 最新

  • dongyou6795 2017-03-13 16:51
    关注

    I searched again. Now what I found is an other driver software, which is a msi executable file, which installs the odbc driver on the machine.

    https://www.microsoft.com/de-ch/download/details.aspx?id=36434

    I installed that software and now it works without any problems.

    Thanks for all your comments.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测