Applies to:

Zend Server 9
Linux - RPM
Microsoft SQL Server


When connecting through PDO_DBLIB (FreeTDS) to MSSQL with protocol 7.x / 8.0, you might get a connection failure when not setting TCP port.


The FreeTDS library will default to port 4000 instead of 1433, so without explicit definition it will not connect to default port on MSSQL.


1. Configure freetds.conf to include the port to MSSQL (i.e. 1433)

host =
port = 1433
tds version = 8.0

2. Define port under HOST in PDO connection strings:

$dbh = new PDO ("dblib:version=8.0;host=$hostname:1433;dbname=$dbname","$username","$pw");