Jump to content

mssql centos php unable to connect to database.


Recommended Posts



  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=';
$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];



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


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.