PHP, FreeTDS and SQL Server 7

David Derr david.derr at milesmedia.com
Thu Oct 18 22:07:56 EDT 2001


Brian,

I am not sure what changed between 0.51 and the later versions, but when
I tried 0.52 and 0.53pre1 I get seg faults on the apache child when I
try to make a database connection.  My system is RedHat 6.2 connection
to a Win NT Server running SQL7.  

Obviously I have not had a chance to test the configuration with these
later versions because of the seg faults ([Thu Oct 18 22:03:12 2001]
[notice] child pid 28386 exit signal Segmentation fault (11)).  Can you
see anything I am doing wrong?  

Here is my build script:

All done as root...
FREE TDS 0.53
/configure --prefix=/usr/local/freetds --with-tdsver=4.2
--enable-dbmfix 
gmake
make install

edit /etc/profile adding:
export SYBASE=/usr/local/freetds 

Add to /etc/ld.so.conf: 
/usr/local/freetds/lib
Run ldconfig so that the libraries will be found by the linker


APACHE 1.3.14 (the following configuration options assume that php and
apache are in parallel directories)
/configure --prefix=/usr/local/apache_test


PHP 4.0.6
/configure --with-mysql --with-apache=../apache_1.3.14
--enable-track-vars --with-mssql=/usr/local/freetds
--with-sybase=/usr/local/freetds
--with-config-file-path=/usr/local/apache_test/conf 
make
make install


APACHE 1.3.14
/configure --prefix=/usr/local/apache_test
--activate-module=src/modules/php4/libphp4.a
make
make install

Also add the above to the startup script that starts the web server.
SYBASE=/usr/local/freetds 

Thanks,
David Derr

-----Original Message-----
From: bounce-freetds-137737 at franklin.oit.unc.edu
[mailto:bounce-freetds-137737 at franklin.oit.unc.edu] On Behalf Of Brian
Bruns
Sent: Thursday, October 18, 2001 12:46 PM
To: TDS Development Group
Subject: [freetds] Re: PHP, FreeTDS and SQL Server 7


There is a bug in 0.52 regarding the ip lookup that affects some
platforms.  It is fixed in either 0.53pre1 or the CVS version.

Brian

On Thu, 18 Oct 2001, David Derr wrote:

> Hello.  I am trying to use freetds in conjunction with php and MS SQL 
> Server 7.  I have posted a couple quiestions to the php mailing list, 
> but have hit a wall there.
> 
> I have included the reply I recieved to the first post and my second 
> post below.  I believe I have a configuration problem unrelated to php

> or the database because it seems freetds always wants to connect to 
> 255.255.255.255 port 0 and that is not what I had in the interfaces 
> file.
> 
> Any help would be greatly appreciated.  I am sooo close and I really 
> hope this solution will perform better than our existing one which is 
> using an ODBC bridge.
> 
> Thanks!
> David Derr
> 
> 
> Posteded to the PHP General Mailing List...
> 
> Thanks for you build record, that helped greatly,  I think my main 
> problem was using 0.52 instead of 0.51.
> 
> No more seg faults now when I try to run my script, but I am still not

> getting a connection to the database, and I think the problem may be 
> the fact the freetds is not finding any configuration information.  
> Here is the php script I am running:
> 
> <?
> putenv("TDSDUMP=/usr/local/apache_test/logs/tds.log");
> 
> $nDBConn = mssql_connect("mmg", "username", "passwd");
> echo "ConnectID: $nDBConn<br>\n";
> 
> $nStmt = mssql_query("select * from david_test", $nDBConn);
> 
> while ($aRow = mssql_fetch_array($nStmt)) {
>         echo $aRow["Name"];
>         echo "<p>\n";
> }
> 
> mssql_close($nDBConn);
> echo "hello dave";
> ?>
> 
> And when this runs there are connection errors, but if I look in the 
> TDSDUMP file I specified at the beginning of the script I see this 
> (which is not the ip or port I specified in my interfaces file): 
> 2001-10-17 09:39:24 Connecting addr 255.255.255.255 port 0
> 
> Along with these errors in my Apache error log file:
> connect: Network is unreachable
> DB-Library: Login incorrect.
> 
> Here is my interfaces file, located at /usr/local/freetds
> mmg
>         query tcp tds4.2 ip.of.db.server 1433
> 
> And last, here is the value of the SYBASE env variable:
> [root /root]# echo $SYBASE
> /usr/local/freetds
> 
> Did you or anyone else run in to this problem?  I looked in the config

> file to see if there was a path you could specify for the interfaces 
> file but found only an alternate method of configuring freetds, so I 
> renamed it to zzz_freetds.conf and still get the error message saying 
> it is connecting to 255.255.255.255.
> 
> Thanks again in advance for any help.
> 
> David Derr
> davidderr at britsys.net
> 
> 
> -----Original Message-----
> From: Nick Talbott [mailto:nickt at powys.gov.uk]
> Sent: Tuesday, October 16, 2001 11:45 AM
> To: David Derr; php-general at lists.php.net
> Subject: Re: [PHP] FreeTDS and SQL Server 7
> 
> On Tuesday 16 October 2001 4:18 pm, David Derr wrote:
> > Hey all, I was reading an old article at php builder about 
> > conntecting to SQL Server 7 on a Windows machine from a Linux 
> > machine via FreeTDS.
> > (http://www.phpbuilder.com/columns/alberto20000919.php3)
> [snip]
> >
> > Has anyone had sucees in getting this to work?  I will include my 
> > config and compile commands below as well as the php script that is 
> > breaking things.
> [snip]
> 
> We have that working reliably with the exception that I have used TDS
> protocol version 4.2 rather than 7.0 because I had read that this was
a 
> little less well developed, and 4.2 gives you all you need in any
case.
> 
> We're using slightly different components:  Apache 1.3.20, PHP 4.0.6, 
> FreeTDS 0.51 running on a Slackware 8.0 base (Linux kernel 2.2.19 with

> glibc
> 2.2.3)
> 
> I've attached an HTML file of our build record for this.
> 
> The other thing to note is that this approach allows you to use PHP's 
> mssql_ calls, but only those that have direct sybase_ equivalents.  So

> make sure you
> check out which calls are common to both sets of functions and don't
try 
> calls that only exist in the mssql_ function list.
> 
> Regards
> 
> Nick Talbott, IT Policy and Strategy Manager, Powys County Council
> email:	nickt at powys.gov.uk
> fax:	01597 824781
> web:	www.powys.gov.uk and www.powysweb.co.uk
> 
> 
> ---
> You are currently subscribed to freetds as: [camber at ais.org] To 
> unsubscribe, forward this message to 
> $subst('Email.Unsub')
> 


---
You are currently subscribed to freetds as: [david.derr at milesmedia.com]
To unsubscribe, forward this message to
$subst('Email.Unsub')






More information about the FreeTDS mailing list