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