Koozali.org: home of the SME Server

PHP Connection to MSSQL database

g00s3m4n

PHP Connection to MSSQL database
« on: January 05, 2006, 01:48:07 PM »
Hello..

I am looking to connect to and query a mssql database from a PHP page running on my SME 6.01 server. I have installed all updates and updated my PHP version to 4.4.1 (thanks to Ergin's script)

I get the following error in my messages log:

httpd: PHP Fatal error:  Call to undefined function:  mssql_connect() in /home/e-smith/files/ibays/Primary/html/test.php on line 5

I have trawled the forums looking for help and what I have found is that supposedly I am to install sybase support from http://rpms.arvin.dk/php, the problem is that it is for the wrong version..

All I need want to do it setup a simple page with 3 tables that will query the mssql db for the vales..

can anyone steer me in the right direction?

thanks

ruwanj

PHP Connection to MSSQL database
« Reply #1 on: January 09, 2006, 09:32:19 AM »
See here,

http://webmonkey.wired.com/webmonkey/99/21/index2a_page6.html?tw=programming

If you dont get it, review all the lessons..

-Ruwan

g00s3m4n

PHP Connection to MSSQL database
« Reply #2 on: January 09, 2006, 10:23:11 AM »
thanks for the reply... but that appears to be for mysql and not mssql

Offline NickCritten

  • *
  • 245
  • +0/-0
PHP Connection to MSSQL database
« Reply #3 on: January 20, 2006, 01:02:02 PM »
Hi g00s3m4n,

By far the easiest method of connecting to MS-SQL from an sme box is to use unixODBC.
I have successfully done this (Remarkably easily) on SME7, but the method should be virtually identical on 6.
You need to install unixODBC, and the php-odbc extension (Ergins script installs both - I think)

You then need to install freeTDS...
visit http://ibiblio.org/pub/Linux/ALPHA/freetds/stable/redhat/RPMS/ and download the main, and unixODBC rpms.

Copy them to your SME and install them both.

Now you just need to create/modify freetds.conf odbcinst.ini & odbc.ini

If you want help doing this, let me know :)
...
Nick

"No good deed goes unpunished." :-x...

Offline NickCritten

  • *
  • 245
  • +0/-0
PHP Connection to MSSQL database
« Reply #4 on: February 01, 2006, 06:59:30 PM »
I've now completed an MSSQL howto:

Please see http://forums.contribs.org/index.php?topic=30342.0
...
Nick

"No good deed goes unpunished." :-x...