views:

726

answers:

2

I need to connect to a MS SQL Server on Windows from PHP running on Red Hat Enterprise Linux 4. I have installed FreeTDS and I can connect to the database using the tsql command.

My current PHP does not have the mssql functions/extension.

My question is, how do I set up the mssql extension without rebuilding PHP? Is there a prebuilt package for this? I have tried googling for this but I have had no luck.

A: 

There is no way you can setup mssql extension to work without rebuilding PHP. PHP Group aims at giving interoperatable and independent code. MS SQL and Sybase both require freetds, which isn't and shouldn't be part of PHP Package. Maintaining a rpm or deb for a custom package would again be a pain. Hence you have to manually build it.

Alagu
+1  A: 

If you are using the stock version of PHP that comes with RHEL 4.x, you can install the php-odbc module. FreeTDS provides an ODBC interface. You should be able to use these together to connect PHP to a MSSQL server.

That said, I suggest rebuilding PHP so you have access to the mssql extension. That should result in better performance and reliability than using ODBC in this fashion.

(For what it's worth, RHEL 5.x has a php-mssql RPM you can install.)

Chris Ess
Thanks to you I did my first configure, make, make install! Except with about 20 arguments to the configure command. Victory is mine!
Liam