Php – Ubuntu PHP and sqlsrv_connect()

PHPsql serverUbuntu

I'm using a class that uses sqlsrv_connect() in PHP to connect to a MSSQL database server, but I always get this error:

Fatal error: Call to undefined function sqlsrv_connect()

I’ve done multiple install methods such as:

sudo apt-get install -y freetds-bin freetds-common tdsodbc odbcinst unixodbc php5-sybase

Restarted apache but none of them seem to solve the problem of the libraries being added. Can help give some guidance on the problem?

I'm using:

PHP 5.3.10-1ubuntu3.1 with Suhosin-Patch (cli) (built: May  4 2012 02:20:36) 

Best Answer

Linux based PHP does not support the sqlsrv_* functions. Those are only provided by the Windows driver. FreeTDS will provide you with access to the old mssql_* functions.