[RESOLVED] Issues with MSSQL connection on Centos 5.8

Issues related to software problems.
Post Reply
Tim0401
Posts: 2
Joined: 2012/10/31 01:27:46
Contact:

[RESOLVED] Issues with MSSQL connection on Centos 5.8

Post by Tim0401 » 2012/10/31 01:47:54

Hi Everybody,

Thank you for your help in advance...

We currently have a Centos 5.8 box with Cpanel that had FreeTDS and UnixODBC setup on it to connect to a remote MSSQL database through php.

the other day were were installing a web app that required a later version of PHP. Through Cpanel we upgraded from php 5.2.17 to 5.3.18.

Seemed like everything was fine until we realised that the MSSQL connection no longer works.

I have tried everything i can find online to resolve this issue but nothing seems to work.

Some things tried to try and resolve include:

reinstalling both freetds and unixodbc

checking all .ini and .conf files

checked all file permissions to ensure apache has access to configs.

Tried rolling back to php5.2.17

I have a successful connection running through TSQL however not through PHP

We get the error "Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server"


Any and all help is greatly appreciated

Many thanks

Tim0401
Posts: 2
Joined: 2012/10/31 01:27:46
Contact:

Re: [RESOLVED] Issues with MSSQL connection on Centos 5.8

Post by Tim0401 » 2012/10/31 05:08:26

[RESOLVED]

Issue is now fixed but thought i would post the solution

We were able to get a perfect connection through TSQL because it was referencing the freetds.conf file at /usr/local/etc/freetds.conf

After enabling error logging in the freetds.conf file I noticed that if I deleted the error log and ran the TSQL query it would produce a new file, however when I ran the query through php it would not produce a new file.

I ran a locate command to find all other instances of the freetds.conf file and it brought up 6 different results.

From this point it was just a matter of enabling the error logging in each individual freetds.conf file and seeing if a file would get created after running the php script through the browser.

I found the file which it was referencing through php and there was no config for our required setup. The file was located at /usr/local/freetds/etc/freetds.con

The error log noted that because there was no config it was trying to connect on the default port of 4000

Created a new entry in the right config file and specified port 1433 and it worked perfectly.

During the install process for some reason it created multiple config files in different locations. I am putting this down to Cpanel and its crappy folders that it puts on a server.

Post Reply