views:

609

answers:

3

I've inherited some code that uses the sqlsrv_connect method to instantiate a connection to a SQL Server database. My personal development machine is an OS X box that I'm running apache an PHP on. I have an instance of SQL Server running in a virtual machine.

When I attempt to connect to the database, I get the following error.

Fatal error: Call to undefined function sqlsrv_connect() in ...

It appears that sqlsrv_connect is not part of standard PHP, and is part of a driver that ships with SQL Server 2005. (please correct me if I'm wrong here)

Is there a way to use this function on Non-Windows platforms? I realize I could install/build an Apache/PHP instance on my Windows machine, but if there's a way to get this function working on OS X (or other *nixes) I'd prefer it.

+2  A: 

You can look here for a tutorial on how to install the extension. (Via Google)

I'm not too famillar with the extension, but that source should be able to help you out.

(Updated Link to Better Source, still via Google)

Chacha102
+1 for useful information, but I want to install the driver on OS X, (or be told it's not possible by someone with authority on the subject).
Alan Storm
+3  A: 

Is not possible. The SQL Native Driver for PHP is Windows only product:

The SQL Server Driver for PHP relies on the Microsoft SQL Server 2005 ODBC Driver to handle the low-level communication with SQL Server. As a result, the SQL Server Driver for PHP is only supported on Windows.

Remus Rusanu
A: 

The SQL Server Driver for PHP (from MS) is available only on Windows. Unless you want some specific features offered by this driver/ API, you can use the PHP ODBC module along with UnixODBC/ iODBC driver, or FreeTDS (ODBC or db-lib)

CruiZen