Download the Microsoft Drivers for PHP for SQL Server
php.ini
extension=php_pdo_sqlsrv_71_nts_x64.dll
extension=php_sqlsrv_71_nts_x64.dll
$dbh = new PDO("sqlsrv:Server=192.168.168.33,1433;Database=My_DB", "username", "password");
$server = "192.168.168.33"; $coninfo = array("Database"=>"My_DB", "UID"=>"username", "PWD"=>"password"); $conn = sqlsrv_connect($server, $coninfo) or die ("连接失败!"); var_dump($conn); sqlsrv_close($conn);