Welcome to the most active Linux Forum on the web.
Go Back > Forums > Other *NIX Forums > *BSD
User Name
*BSD This forum is for the discussion of all BSD variants.
FreeBSD, OpenBSD, NetBSD, etc.


  Search this Thread
Old 07-03-2006, 02:15 PM   #1
Registered: Feb 2006
Distribution: Debian 40r0
Posts: 103

Rep: Reputation: 15
issue with unixodbc + freetds + php

hi, first of all congratulations for this great forum and for its 4 years...

as this is the first time im using unixodbc and freetds i have few related questions..., this is my current scenario: I have installed the php5-mssql (i installed that port because i think its my option since i want to use freetds, excuse my expierence-less)
I just installed the folow ports: php5-mssql, freetds, and unixodbc, i just use the 'make install clean' script for perform the installation proccess, and i didnt use any special paramethers or some...
Also im not sure how to config the unixodbc .conf files, because they are blank (no sample configuration)
This is the conf sections I have: this php configuration:

my settings for: /usr/local/etc/freetds/interfaces.dist

        query tcp 8.0 xx.xx.xx.11 1433

        query tcp 4.2 5000
        master tcp 4.2 5000
my settings for: /usr/local/etc/freetds.conf.dist
        # TDS protocol version
        tds version = 8.0

;       initial block size = 512
;       swap broken dates = no
;       swap broken money = no
;       try server login = yes
;       try domain login = no
;       nt domain = GIGA
;       cross domain login = no
;       dump file = /tmp/freetds.log
;       debug level = 10
;       timeout = 10
;       connect timeout = 10
        text size = 64512
        host =
        port = 5000
        tds version = 4.2

        host = xx.xx.xx.11
        port = 1433
        tds version = 8.0
my settings for: /usr/local/etc/odbc.ini
Driver = /usr/local/lib/
Server = xx.xx.xx.11
Database = crafta-pos
Port = 1433
TDS_Version = 8.0
my settings for: /usr/local/etc/odbcinst.ini
Driver = TDS
Description = crafta-pos Database
Trace = No
Server = xx.xx.xx.11
Database = crafta-pos
I tried to test the freetds with this command: ' tsql -S xx.xx.xx.11:1433 -U MYUSERNAME "
and with this results:
locale is "C"
locale charset is "US-ASCII"
Password: *****
Msg 20004, Level 9, State 0, Server OpenClient, Line 0
Read from SQL server failed.
Msg 20014, Level 9, State 0, Server OpenClient, Line 0
Login incorrect.
There was a problem connecting to the server
This is the php test script:
$connect = mssql_connect("pos-server", "****", "*****");
$query = "SELECT ItemLookupCode FROM Item";
$result = exec($connect, $query);
$ItemLookupCode = mssql_result($result, 1);
echo $ItemLookupCode;
echo "\n";
getting this errors in the browser ouput: 
 - Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: pos-server in /usr/local/www/data-dist/odbc.php on line 2
 - Warning: exec() [function.exec]: Cannot execute a blank command in /usr/local/www/data-dist/odbc.php on line 4
 - Warning: mssql_fetch_row(): supplied argument is not a valid MS SQL-result resource in /usr/local/www/data-dist/odbc.php on line 5


$connect = odbc_connect("xx.xx.xx.11", "******", "******");
$query = "SELECT ItemLookupCode FROM Item";
$result = odbc_exec($connect, $query);

$ItemLookupCode = odbc_result($result, 1);
print ("$ItemLookupCode\n");
getting this error:
Fatal error: Call to undefined function odbc_connect() in /usr/local/www/data-dist/odbc1.php on line 2
ahy help with this will be apreciated, and thanks in advance.


Last edited by sugar2; 07-03-2006 at 02:40 PM.
Old 07-03-2006, 08:45 PM   #2
Registered: Feb 2006
Distribution: Debian 40r0
Posts: 103

Original Poster
Rep: Reputation: 15
the issue was solved
i just recompiled the php5 with odbc support instead of mssql support
and made a correction in the php script, i used the host name instead of the ip of the sql server




Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
question before moving from windows2003 to Linux+apache+php+iodbc+FreeTDS sugar2 Linux - Newbie 6 06-30-2006 01:00 PM
apache+php+unixODBC don't work Taxinha Linux - Software 0 05-17-2006 05:23 AM
freetds to access SQL server from linux client sailu_mvn Linux - Software 2 12-06-2005 11:19 PM
FreeTDS Install Problem wizhuff Linux - Software 1 07-27-2005 01:45 PM
freetds-perl-linux-m$sql hrc Linux - Software 0 03-08-2004 09:35 AM > Forums > Other *NIX Forums > *BSD

All times are GMT -5. The time now is 07:21 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration