I need to connect to a MSSQL database from a Linux CentOS server with Plesk installed. I have tried to use the code but I get this: Fatal error: Call to undefined function: mssql_connect() in /var/www/vhosts/*****.com/httpdocs/register/load/functions.php on line 65 Im running version 4.3.9 of PHP. Why is it doing this?
See if these procedures have been followed on your server... http://us2.php.net/manual/en/ref.mssql.php
Hey, thanks for that. Ihave been reading it for the past 30 minutes. I think my main problem is I am running Plesk also. I am not sure what damage I will do if I recompile PHP. Do you know if Im likely to mess things up?
You are actually in an entirely different mess of problems. Plesk has nothing to do with it. I am in the final stage of integrating a Fedora 5 Linux server with a MSSQL database on a Windows server. Here's the problem. MSSQL is a windows program. Even though SQL is a universal language, MSSQL is not a universal platform. Linux and php do not inherently have the ability to integrate with MSSQL. All of the mssql_connect and other functions are exclusive to windows machines running php. There are back-end hacks that can setup linux php with the mssql libraries, but these aren't supported by anything solid that I have found. Here's where it gets ugly, this is what you need to do to get php integrated with mssql. This is a very complicated setup, and everything needs to be done through the command line. First off, you need to make sure that your server and php have odbc support. Linux needs a driver called freetds. http://www.freetds.org/ Linuc also needs to have a library called unixodbc. http://www.unixodbc.org/ Either of these can be installed with rpm, yum, or command line compiling. Once you are able to connect to the database via linux command line: tsql and isql, you then should be able to connect with php using odbc_connect (not mssql_connect). You also need to make sure php is compiled with php-odbc, otherwise it has no way of connecting with the odbc driver. Here are some links as to how to get this setup. http://www.webthatworks.it/drupal/2006/11/db/odbc_freetds_and_microsoft_sql_and_php http://www.linuxjournal.com/article/6636 I have been working on this one for several weeks, and it is by no means an easy process. If you don't have a lot of linux administration experience, i recommend having someone who does figure it out. Anyway, I don't mean to try to scare you out of this, but I was in the same position about a month ago when I though all I needed to do was recompile php. I never realized it was this difficult to get linux php to talk to a windows mssql server.