freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: Gabriel Ricard <gabe AT imaxsales.net>
- To: freetds AT franklin.oit.unc.edu
- Subject: Problem with FreeTDS 0.52 and PHP 4.0.6
- Date: Wed, 5 Sep 2001 18:23:45 -0400
Greetings Folks,
I am having a bit of a problem with FreeTDS 0.52 & PHP 4.0.6 on MacOS X.
I have compiled FreeTDS 0.52 successfully. With my configuration for our MS SQL 6.x server, the 'make check' tests pass 3 out of 6 (the first three pass). I know that it can connect to my DB server.
I have installed FreeTDS in /usr/local/freetds/. When I built PHP, I specified --with-sybase_ct=/usr/local/freetds on the configure command. When I go to use either sybase_connect() or mssql_connect(), Apache dies.
I investigated the problem by building PHP as a CGI binary and running the script from the command line through gdb. This is the output that followed:
[hancock:~] root# gdb /usr/local/bin/php
GNU gdb 5.0-20001113 (Apple version gdb-186.1) (Sun Feb 18 01:18:32 GMT 2001) (UI_OUT)
Copyright 2000 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "powerpc-apple-macos10".
Reading symbols for shared libraries ... done
(gdb) run
Starting program: /usr/local/bin/php
[Switching to thread 1 (process 12126 thread 0x1903)]
<?
mssql_connect("MYDB", "MYUSERNAME", "MYPASSWORD");
?>
Program received signal EXC_BAD_ACCESS, Could not access memory.
0x70026ea4 in inet_aton ()
(gdb) bt
#0 0x70026ea4 in inet_aton ()
#1 0x7002b8d4 in inet_addr ()
#2 0x000d3ab8 in tds_connect (login=0x3b2f70) at login.c:153
#3 0x000cd03c in ct_connect (con=0x3b2f40, servername=0x3b2dcc "MYDB", snamelen=2) at ct.c:298
#4 0x0009b7b0 in php_sybase_do_connect_internal (sybase=0x3b2f1c, host=0x3b2dcc "MYDB", user=0x3b2e6c "MYUSERNAME", passwd=0x3b2eac "MYPASSWORD") at php_sybase_ct.c:415
#5 0x0009be64 in php_sybase_do_connect (ht=3878684, return_value=0x3b2ecc, this_ptr=0x200, return_value_used=0, persistent=27) at php_sybase_ct.c:622
#6 0x0009c038 in php_if_sybase_connect (ht=3, return_value=0x3b2ecc, this_ptr=0x0, return_value_used=0) at php_sybase_ct.c:668
#7 0x0002c3e0 in execute (op_array=0x3b1d3c) at ./zend_execute.c:1504
#8 0x00005680 in zend_execute_scripts (type=0, file_count=3) at zend.c:752
#9 0x0000ea60 in php_execute_script (primary_file=0xbffffcb8) at main.c:1206
#10 0x00002c48 in main (argc=1, argv=0xbffffddc) at cgi_main.c:718
#11 0x00001c28 in _start ()
#12 0x00001a68 in start ()
#13 0x00000000 in ?? ()
(gdb)
So, for some odd reason, when I run the 'make check' tests, they can read in the configuration file, and connect to the appropriate hostname (in this case I am providing it an IP address). I have run tcpdump to ensure that the 'make check' tests actually have connected to the database, and they have. The logs from the test connections in /tmp are accurate also. I know it can connect to the server, but for some reason, when I try to connect using the FreeTDS library in PHP, it doesn't work.
Is there something I have configured wrong in PHP? I have tried setting the environment variable SYBASE=/usr/local/freetds, and that does not help either, I get the same effect. It seems almost as if it is not pulling the IP address from the config file, and thus is passing garbage to inet_addr() in tds_connect() in src/tds/login.c. I have spent a lot of time trying to figure out what is going on, but I just don't know how to fix this on my own.
Does anyone have any ideas on why it's not working from PHP?
(please respond to me, and not just the mailing list address as I am not on the mailing list)
Thank you very much,
Gabriel Ricard
- Problem with FreeTDS 0.52 and PHP 4.0.6, Gabriel Ricard, 09/05/2001
Archive powered by MHonArc 2.6.24.