PHP PDO_mssql SQLSTATE[01002] Adaptive Server connection failed (severity 9)

前端 未结 2 589
小蘑菇
小蘑菇 2020-12-09 19:33

I\'m connecting to external MSSQL database for exports from PHP55/osx and I have wierd issue.

code:

new \\PDO(\"dblib:host={$hostnam         


        
2条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-09 20:28

    Check these:

    1. locate freetds.conf on your disk. It is possible it exists in several places and tsql uses one while PHP used another one. Best is to symlink them into one common file and test on that. Note that a common place for that file is ~/.freetds.conf beside /etc/ or /usr/local/etc/

    2. there should be a [global] section on your freetds.conf file. Put there these lines :

      tds version = 8.0

      text size = 20971520

      client charset = UTF-8

    Of course, I expect that you already checked which driver is loaded by PHP with phpinfo(): mssql, sqlsrv or dblib

提交回复
热议问题