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 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 lammps拉伸应力应变曲线分析
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥15 请问Lammps做复合材料拉伸模拟,应力应变曲线问题
  • ¥30 python代码,帮调试,帮帮忙吧
  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建