Skip to Content.
Sympa Menu

freetds - 0.60 + PHP + MSSQL2K segfault -- depends on the query (??)

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Paul Kiela" <pkiela AT sendtec.com>
  • To: freetds AT franklin.oit.unc.edu
  • Subject: 0.60 + PHP + MSSQL2K segfault -- depends on the query (??)
  • Date: Fri, 15 Nov 2002 15:14:02 -0500


Hey guys,

Having a segfault problem getting data out of my MS-SQL server using FreeTDS
and PHP.

Here's the scoop:
Apache 1.3.26
PHP-4.2.2
FreeTDS 0.60
MS SQL Srv 2000 Enterprise

Here's my freetds.conf:
[global]
tds version = 4.2
initial block size = 512
swap broken dates = no
swap broken money = no
try server login = yes
try domain login = no
cross domain login = no
dump file = /tmp/freetds.log
debug level = 10
[OfferAPI]
host = xxx.xxx.xxx.xxx
port = 1433
tds version = 4.2


Here's my PHP code:

<?php
$db_handle = sybase_connect("OfferAPI","user","pass");
sybase_select_db("OfferAPI", $db_handle);
$db_result = sybase_query("select * from Orders where LompID like '%LOMP%'");
print sybase_num_rows($db_result);
?>

it should return two records.

when I run it with php -q from the commandline, as from apache, I receive a
Segmentation Fault either to the commandline or in my apache error log.

Since the freetds.log is rather large, you can access it via

http://www.initsix.org/freetds.log.html

here's the backtrace. I'm very new to gdb so I'm not even sure where to begin
with this file. I can figure out a little of what its doing, but i'm pretty
lost:

(gdb) run blah.php
Starting program: /usr/local/bin/php blah.php
X-Powered-By: PHP/4.2.2
Content-type: text/html

0

Program received signal SIGSEGV, Segmentation fault.
0x080da4e4 in shutdown_memory_manager (silent=0, clean_cache=0)
at zend_alloc.c:467
467 REMOVE_POINTER_FROM_LIST(ptr);
(gdb) bt
#0 0x080da4e4 in shutdown_memory_manager (silent=0, clean_cache=0)
at zend_alloc.c:467
#1 0x0806293b in php_request_shutdown (dummy=0x0) at main.c:794
#2 0x0806176b in main (argc=2, argv=0xbffffb64) at cgi_main.c:827
#3 0x400f5507 in __libc_start_main (main=0x8060e74 <main>, argc=2,
ubp_av=0xbffffb64, init=0x805f858 <_init>, fini=0x81052b0 <_fini>,
rtld_fini=0x4000dc14 <_dl_fini>, stack_end=0xbffffb5c)
at ../sysdeps/generic/libc-start.c:129
(gdb)

I guess what's funnier is that when I change the SQL query from select * to
select count(*), I get the following:

(gdb) run blah.php
Starting program: /usr/local/bin/php blah.php
X-Powered-By: PHP/4.2.2
Content-type: text/html

1

Program exited normally.
(gdb)



Any suggestions as to what may be wrong, how I should go about fixing this?





  • 0.60 + PHP + MSSQL2K segfault -- depends on the query (??), Paul Kiela, 11/15/2002

Archive powered by MHonArc 2.6.24.

Top of Page