🗄️ MSSQL Server Connection Test

📋 Environment Check

Extension: pdo
✓ Loaded
Extension: pdo_sqlsrv
✗ Not Loaded
Extension: sqlsrv
✓ Loaded
PHP Version
7.4.11
Operating System
Windows NT EC2AMAZ-14NSJLJ 10.0 build 17763 (Windows Server 2016) AMD64

🔧 Connection Configuration

Server Address
202.160.160.122
Port
21474
Username
tabuser2023
Database
KsmErp

🔌 Connection Test #2: SQLSRV (Native)

Attempting connection using SQLSRV native driver...

Connection Method
SQLSRV (Microsoft Native Driver)
Connection Time
280.2 ms
Server Name
KMLHP_REDSELTOS
Connected Database
KsmErp
Session ID (SPID)
72
SQL Server Version
Microsoft SQL Server 2016 (SP2) (KB4052908) - 13.0.5026.0 (X64) Mar 18 2018 09:11:49 Copyright (...

❌ SQLSRV Connection: FAILED

Error: Query failed

SQLSRV Error Details:

SQLSTATE: 42000
Code: 156
Message: [Microsoft][ODBC Driver 18 for SQL Server][SQL Server]Incorrect syntax near the keyword 'current_time'.

📊 Overall Connection Summary

ExtensionAvailableStatusDetails
PDO_SQLSRV❌ NoN/AExtension not loaded
SQLSRV✅ Yes✅ SUCCESSConnect: 280.2ms
PDO_ODBC❌ NoN/AExtension not loaded

✅ At Least One Connection Method Succeeded!

Your PHP environment can successfully connect to the MSSQL server. You can use any of the successful connection methods in your application.

📝 Recommended Extension

SQLSRV is available and working well:

🌐 Network Diagnostics

DNS Resolution
✓ IP address format valid: 202.160.160.122
Port Validation
✓ Valid port number: 21474
TCP Socket Test
✓ Port is open and accepting connections

💻 Sample Connection Code

Using SQLSRV:

<?php
$serverName = "202.160.160.122,21474";
$connectionInfo = [
    "Database" => "KsmErp",
    "UID" => "tabuser2023",
    "PWD" => "iKsml#2023"
];

$conn = sqlsrv_connect($serverName, $connectionInfo);

if ($conn === false) {
    die(print_r(sqlsrv_errors(), true));
}

// Example query
$sql = "SELECT * FROM your_table";
$stmt = sqlsrv_query($conn, $sql);

if ($stmt === false) {
    die(print_r(sqlsrv_errors(), true));
}

while ($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {
    echo $row['column_name'] . "\n";
}

sqlsrv_free_stmt($stmt);
sqlsrv_close($conn);
?>
Test completed in: 443.79 ms
Timestamp: 2026-10-15 16:17:20 UTC