LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   PHP and MSSQL (https://www.linuxquestions.org/questions/linux-software-2/php-and-mssql-102406/)

BBPS 10-10-2003 06:39 AM

PHP and MSSQL
 
Hi,

I am fairly new to Linux, and need some help please.

I have RH9 2.4.20-8, and PHP 4.2.2 installed.

I am writing some PHP pages, to read info from some databases. I have no problem accessing data from MySQL, so that is fine. I need to access an MSSQL server we have, and before you ask I cannot move the data over to MySQL as to much relies on it already.

I have installed and configured the FreeTDS, and this works fine as I can connect to our MSSQL server on a Win2K box using the tsql command....so I know the link between Linux and the SQL Server is working.

When I try to connect to the MSSQL server in PHP I get the following error:

Fatal error: Call to undefined function: mssql_connect() in /var/www/html/test/test.php on line 11

Lince 11 of my code is: $conn=mssql_connect('MSSQLSERVER','user','password');

I have done a lot of reading, but keep going round in circles.

I believe that all I need to do is enable the option: --with-sybase=/var/local/freetds

I am not sure of the easiest way to achieve this, and I certainly don't want to change/mess up anything that is already working.

Apache and PHP were installed as part of the main install from the RH9 CD's, if that information is needed.

Can someone give me some detailed help/advice please, or point me in the right direction, the more detailed the better. ;)

Many thanks in advance.


Paul.

Hans Zarkoff 10-10-2003 10:18 AM

You're absolutely right. You will need to recompile php with that configure option.

You can download the source RPM if they aren't already included with your CDs. If they aren't available or whatever, you can grab the original tarball from php.net. I think you'll also need the Apache source so get that too.

I hate to suggest it, but if you have never compiled php from scratch, you may very well mess it up the first one or two times. Be sure to copy your httpd.conf and php.ini file to a safe spot in the event the installer overwrites them. If things *really* get screwed up, just reinstall your rpms and everything will be back to the way things were. Hopefully.

BBPS 10-10-2003 10:36 AM

Many thanks for the information Hans.

What I may well do is setup another Linux server, and install it all from scratch, that way if I get it wrong it will be easier for me to sort out.

...or there is always the possibility of me installing PHP on one of our W******s 2K servers, but I didn't really want to have to do that.


All times are GMT -5. The time now is 06:20 AM.