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 comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.