phpstudy连接SQL Server 2008数据库 以及 php使用sql server出现乱码解决方式

时间:2021-09-30 07:00:05

开始也尝试自己配置php安装环境,找到一个详细的百度经验http://jingyan.baidu.com/article/154b46315242b328ca8f4101.html,前面有问题也一一去解决了,但最后还是死在Apache启动失败上(估计也是端口问题)。

然后选择了使用phpstudy集成环境。在phpstudy连接sql server 2008数据库这个问题上看了不少帖(大多数是直接写php连接sql server数据库的操作,也是乱的很),这里结合我的操作过程总结了一下:

  • 确保phpstudy成功启动,在PHP扩展里勾选php_sqlsrv和php_pdo_sqlsrv两项;

phpstudy连接SQL Server 2008数据库 以及 php使用sql server出现乱码解决方式

  • 安装Microsoft SQL Server 2008 Native Client,这一步很重要。
  • 测试,在根目录添加index.php文件,代码内容如下:
  •   
     <?php
    $serverName = "填数据库服务器地址"; //数据库服务器地址
    $uid = "填数据库用户名"; //数据库用户名
    $pwd = "填数据库密码"; //数据库密码 $connectionInfo = array("UID"=>$uid, "PWD"=>$pwd, "Database"=>"填数据库名称");
    $conn = sqlsrv_connect( $serverName, $connectionInfo); if( $conn == false){
    echo "连接失败!";
    die( print_r( sqlsrv_errors(), true));
    }else{
    echo "连接成功!";
    }
    ?>

  2016年8月1日补充:

  后续再次配置链接时,出现其他问题:

  • 首先,是sqlsrv的扩展无法实现,这个和phpstudy的设置有关,我反复试了发现在“非服务模式”下,成功概率高一些;

phpstudy连接SQL Server 2008数据库 以及 php使用sql server出现乱码解决方式

  • 而面对启动时端口被占用的情况,在进行端口检测时,使用bat检测,再根据PID,在任务管理器中,关闭相应程序,重启phpstudy,选择“非服务模式”,一般来说就可以在,phpinfo中看到开启了sqlsrv的扩展了;

phpstudy连接SQL Server 2008数据库 以及 php使用sql server出现乱码解决方式   phpstudy连接SQL Server 2008数据库 以及 php使用sql server出现乱码解决方式

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAn4AAADACAIAAAAV7fkbAAAgAElEQVR4nO1dTXLcOg/87uTdu4P3WuUGOYEW3vsIqvIyl5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+u/ix/jeYLFIXf6pSx6WLDrj4u0qTBwQ5fCdoGZLSekGgVnpH8UyVILcRjI+rgxm5Oz6qlTBeE0X5T1f0upb+fNjkEIMi9BFOFRrwi7TlRNi+iy4qkTo/WY92NcMdwHc4pET9rePy6yHBWMidDhDypSw8rCR5a6YltErC1Kg67QKT7iFmpjLJut3gKdqf/v2OBXWTdxvKYwz2yVXwVoQAzcbSaIMnh9QiV4Cg9B2OCRGgQRAak3jJqDJAniK6Jvo2waz0kQnxGkXoIgCII4FKRegiAIgjgUpF6CIAiCOBSkXoIgCII4FKRegiAIgjgUpF6CIAiCOBSkXoIgCII4FKRegiAIgjgUpF6CIAiCOBSkXoIgCII4FKRegiAIgjgUpF6CIAiCOBSkXoIgCII4FKRegiAIgjgUpF6CIAiCOBSkXoIgCII4FKRegiAIgjgUpF6CIAiCOBSkXoIgCII4FKRegiAIgjgU/wdB1cLbaazbZAAAAABJRU5ErkJggg==" alt="" />

  • 我的php版本是5.3,使用的dll文件如下图,接下来重启phpstudy,错误解决;

phpstudy连接SQL Server 2008数据库 以及 php使用sql server出现乱码解决方式

  • 补充一点,在编写php过程中发现,sql server调出来的数据是gb2312,而我前端写有php的文件是utf-8格式,数据输出,常常出现乱码,这里我对数据进行了转换,下图是转换函数,在数据输出时调用;

phpstudy连接SQL Server 2008数据库 以及 php使用sql server出现乱码解决方式