What's the preferred approach to being able to access a Microsoft SQL Server database with PHP 5.3+ on Linux?

Because of the different extension options available these days I am unsure which technique is preferred according to reliability and gratifaction. Right now i'm while using mssql extension with FreeTDS, but Let me determine if this is not the easiest way.

I have heard some recommend using php-odbc/EasySoft since the mssql extension continues to be abandoned - while others have stated going the ODBC route is not well worth the performance hit.

The reaction to this stackoverflow question appears to relate what I am asking, however it's Home windows centric.


I have had great results using PHP's PDO (PHP Data Objects) library with this kind of factor. There's a great tutorial at http://net.tutsplus.com/tutorials/php/why-you-should-be-using-phps-pdo-for-database-access/. Just make certain you apply the following template to initialize your database connection:

$dbh = new PDO("dblib:host=$host;dbname=$dbname", $user, $pass);

I personally use FreeTDS. It's not even close to acceptable. Actually, I discovered your question because My home is hope that there has to be a much better solution and that i keep searching for one. Regrettably, FreeTDS appears to be the greatest option right now, if you are developing inside a Linux atmosphere.

Should you be on Home windows, you can clearly make use of the Microsoft SQL Server motorists for PHP which may be superior, but even so you will find missing features, like support for PDO lastInsertId().