E. Criss
E. Criss

Reputation: 342

mssql_connect in PHP does not exist

I've been struggling with this for a while now and I don't know what I'm missing. The error is:

call to undefined function mssql_connect()

Having looked into it already, I've done about everything I can.

PHP is still not recognizing the function and library classes. I'm stumped as to what I didn't do right and would love some help. If it's helpful, I'm running PHP 5.3.2, IIS, and Microsoft SQL Server 2008.

Upvotes: 1

Views: 3382

Answers (2)

Jon Cram
Jon Cram

Reputation: 17309

You say you are running PHP 5.3.2. The PHP manual states:

This extension is not available anymore on Windows with PHP 5.3 or later.

The PHP MSSQL library is ancient and is no longer considered a viable option.

You should instead examine PDO with either the MSSQL driver or the more reliable ODBC driver.

Microsoft are still developing their own PDO driver. Version 2 was made available June 2010. Microsoft recommend the more stable version 1.1 for production use.

Upvotes: 2

klennepette
klennepette

Reputation: 3196

For SQL Server 2008 on Windows it's sqlsrv_connect This is because Microsoft now uses the SQL Driver for PHP which is now on version 2.0 I believe.

Also it's worth noting that with sqlsrv_query, and mssql_query they switched the parameters around (spent half an hour figuring that out).

Upvotes: 4

Related Questions