从PHP Framework Kohana连接到MSSQL [英] Connection to MSSQL from PHP Framework Kohana

查看:79
本文介绍了从PHP Framework Kohana连接到MSSQL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将php应用程序(使用Kohana框架)与Microsoft SQL Server连接,但失败!!!

I'm trying to connect a php application (using framework Kohana) with Microsoft SQL Server and It fails!!!

技术环境:

  • Microsoft Windows Server 2012 R2 Standard.
  • Kohana框架v2.3.4.
  • XAMPP服务器v1.7.1:
    • Apache v2.2.11.
    • PHP 5.2.9.
    • Microsoft Windows Server 2012 R2 Standard.
    • Framework Kohana v2.3.4.
    • XAMPP Server v1.7.1:
      • Apache v2.2.11.
      • PHP 5.2.9.


      问题摘要:

      • 显然,mssql驱动程序正常!我检查了文件夹"... \ xampp \ php \ ext \"是否具有"php_mssql.dll",并且在php.ini文件中是否有引用……是的!一切都很好!
      • 我在Microsoft SQL Server Management Studio中没有任何身份验证问题(我正在使用SQL Server身份验证). 1
      • 我在Kohana数据库配置中遇到问题(我使用的是Management Studio相同的身份验证数据).我在其中添加了以下内容:

          $ config ['testing'] = array
         (
          '基准'=> TRUE,
          'persistent'=> TRUE,
          'connection'=> array
          (
           'type'=>'mssql',
           'user'=>'username',
           'pass'=>'password',
           'host'=>'SERVERNAME \ SQLEXPRESS',
           'port'=> FALSE,
           'socket'=> FALSE,
           'database'=>'database_name'
          ),
          'character_set'=>'utf8',
          'table_prefix'=>'',
          'object'=> TRUE,
          'cache'=> FALSE,
          'escape'=> TRUE
          );

          $config['testing'] = array
          (
           'benchmark' => TRUE,
           'persistent' => TRUE,
           'connection' => array
           (
            'type' => 'mssql',
            'user' => 'username',
            'pass' => 'password',
            'host' => 'SERVERNAME\SQLEXPRESS',
            'port' => FALSE,
            'socket' => FALSE,
            'database' => 'database_name'
           ),
           'character_set' => 'utf8',
           'table_prefix' => '',
           'object' => TRUE,
           'cache' => FALSE,
           'escape' => TRUE
          );

      但是,Web浏览器的答案是"mssql_connect()[function.mssql-connect]:无法连接到服务器:SERVERNAME \ SQLEXPRESS".

      But, the web browser answer is "mssql_connect() [function.mssql-connect]: Unable to connect to server: SERVERNAME\SQLEXPRESS".

      • 我尝试更改主机名(我认为问题出在这里):没有'\ SQLEXPRESS'并使用计算机IP地址.

      • I tried changing the hostname (I think that the problem is there): without '\SQLEXPRESS' and using the machine IP address.

      我尝试在kohana数据库配置中将用户设置为FALSE并传递属性.

      I tried setting FALSE the user and pass attributes in the kohana database configuration.

      重要的是要说:这台机器是一台测试服务器!我可以将应用程序与开发计算机中的sql服务器连接.因此,我尝试将开发机器应用程序与测试机器数据库服务器连接,但遇到了相同的错误.测试计算机和开发计算机之间的独特技术差异是在我使用SQL SERVER 2016和Windows 10的开发计算机中.在开发计算机中,我使用"Windows身份验证"在Management Studio中进行了身份验证,并设置了FALSE用户和密码在kohana数据库配置中.

      It's important to say: this machine is a testing server! I could connect the application with a sql server in a development machine. So, I tried to connect the development machine application with the testing machine database server and I got the same error. The unique technical differences between the testing and development machines are in the development machine I'm using SQL SERVER 2016 and Windows 10. In the development machine I authenticate in the Management Studio with the "Windows Authentication" and I set FALSE the user ans pass in the kohana database configuration.

      可能是什么问题?谢谢!

      What is it could be the problem? Thanks!

      推荐答案

      该解决方案设置了文件流属性(在Sql Server配置管理器中-> SQL Server服务->右键单击SQL Server(SQLEXPRESS)->属性-> FILESTREAM),为Transact-SQL和文件IO访问启用文件流,并允许远程客户端访问FILESTREAM数据.

      The solution is set the filestream properties (in Sql Server Configuration Manager -> SQL Server Services -> Right click on SQL Server (SQLEXPRESS) -> Properties -> FILESTREAM), enabling filestream for Transact-SQL and file IO accesses and allowing remote clients access to FILESTREAM data.

      这篇关于从PHP Framework Kohana连接到MSSQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆