duanmaifu3428 2016-11-15 17:53
浏览 41

IIS 6.2上的PHP 5.6 + MS SQL连接无法正常工作

I am trying to fix an error while trying to connect to MSSQL using PHP on my windows server running IIS.

The error that I am getting is - ODBC error.

Sorry can't copy the error text here and hence the image.

I have PHP 5.6 configured and working. The necessary dll files are there in the php extensions folder. They're also configured in the ini file.

Extensions used for the MSSQL connection are:

extension=php_sqlsrv_56_nts.dll
extension=php_pdo_sqlsrv_56_nts.dll

I am using the below sample code to connect to the mssql db:

<?php
$servername = "ServerName";
$conninfo = array ("Database" => "DBName", "UID" => "UserName" , "PWD" => "Password");
$conn = sqlsrv_connect($servername, $conninfo);

if($conn){
echo "Connection Established."
}else{
die(print_r(sqlsrv_errors(), true));
}
?>

The connection always gives me the error shown in the image attached.

I have been stuck with this for quite a few days and haven't been able to get this resolved.

Any help would be greatly appreciated.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 opencv图像处理,需要四个处理结果图
    • ¥15 无线移动边缘计算系统中的系统模型
    • ¥15 深度学习中的画图问题
    • ¥15 java报错:使用mybatis plus查询一个只返回一条数据的sql,却报错返回了1000多条
    • ¥15 Python报错怎么解决
    • ¥15 simulink如何调用DLL文件
    • ¥15 关于用pyqt6的项目开发该怎么把前段后端和业务层分离
    • ¥30 线性代数的问题,我真的忘了线代的知识了
    • ¥15 有谁能够把华为matebook e 高通骁龙850刷成安卓系统,或者安装安卓系统
    • ¥188 需要修改一个工具,懂得汇编的人来。