http://www.synet.sk/php/en/230-php-drivers-for-microsoft-sql-server-mssql-sqlsrv-utf8
http://stackoverflow.com/questions/5953882/connecting-to-mssql-using-pdo-through-php-and-linux
http://stackoverflow.com/questions/10834175/php-5-4-on-linux-how-to-connect-with-ms-sql-server-2008
http://pymssql.sourceforge.net/faq.php
And remember whereever you are, server might be stupid and not USEing database. So tell it explicitly just to be safe.
Probably better to memorize these: http://www.sql-server-helper.com/error-messages/msg-1-500.aspx