Jump to content

mssql centos php unable to connect to database.


synking

Recommended Posts

Hey,

 

  I need some help i am missing something i think i just don't know what.

 

I have a centos server that a member of the domain.  I have php apache installed and working.

 

I want to connect to an mssql server that is used by the company for different reasons.

 

I have installed freetds, linuxODBC.  They are working perfect from the command line.  I can connect to the mssql server via terminal.

 

But i can not access the server through php and i am not sure why.

 

Here is my php code.

 

$vocname = 'voc';
$vocpass = 'VOC';
$vocserv = 'Driver={voc};Server=10.92.0.3:database=voc';
$vocdata = 'voc';

$link = mssql_connect($vocserv, $vocname, $vocpass);

if (!$link) {
    die('Unable to connect or select database');
}

# mssql_select_db($vocdata, $link);

$version = mssql_query('SELECT @@VERSION');
$row = mssql_fetch_array($version);

echo $row[0];

mssql_free_result($version);
mssql_close($link);

 

I have tried and bunch of differnet combos with the server name and connection type.  I tried to use just the odbc php mod but that didn't work either.

 

The only error i get in error_log from apache is that it is unable to connect.  Can anyone give some advice.

Link to post
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.