How to connect to mssql using pdo through PHP and Linux?

前端 未结 4 703
逝去的感伤
逝去的感伤 2020-11-27 04:58

I\'m trying to for a new PDO connection using the following code.

new PDO(\"mssql:driver=????;Server={$serverName};Database={$databaseName}\", $username, $pa         


        
4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-27 05:52

    Try

    $dbh = new PDO ("mssql:host=$hostname;dbname=$dbname","$username","$pw");
    
    $hostname may need to be configured as either...
    $hostname.':'.$port;
    

    OR

    $hostname.','.$port;
    

提交回复
热议问题