|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #12250 Segfault when using FreeTDS connect
Submitted: 2001-07-19 07:58 UTC Modified: 2002-06-19 10:03 UTC
Avg. Score:5.0 ± 0.0
Reproduced:3 of 3 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: dmit at tkb dot lv Assigned:
Status: Not a bug Package: MSSQL related
PHP Version: 4.0.6 OS: Linux 2.4.5 Slackware 8.0
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: dmit at tkb dot lv
New email:
PHP Version: OS:


 [2001-07-19 07:58 UTC] dmit at tkb dot lv
Linux 2.4.5 Slackware 8.0

FreeTDS 0.52:
./configure --with-tdsver=4.2 --enable-msdblib --enable-dbmfix --with-gnu-ld --enable-shared --enable-static 

PHP 4.0.6:
./configure --with-sybase=/usr/local/freetds --with-openssl=/usr/src/openssl-0.9.6b --with-apache=/usr/src/apache_1.3.20 --with-mysql=/usr/local/mysql/ --enable-track-vars

Apache 1.3.20:
./configure --prefix=/usr/local/apache --activate-module=src/modules/php4/libphp4.a --disable-module=imap

Configures OK, compilation successfull, then

/usr/local/apache/bin/apachectl start

Standard PHP functions work, but when trying to connect to MS SQL 6.5 server Apache segfaults:
[notice] child pid 24856 exit signal Segmentation fault (11)

PHP script used:

$connect_id = mssql_connect("server" , "user" , "abcdefg" );

And exactly the same:

$connect_id = mssql_pconnect("server" , "user" , "abcdefg" );

Any solutions?
Tried to compile PHP with ctlib (--with-sybase-ct=/usr/local/freetds) and after patching some source to remove -lsybtcl -lcs -lcomn -lintl compilation went successfull, but finally Apache segfaults the same way.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-06-04 06:52 UTC] alexp at mail dot lv
Did you add entry for you SQL server in freetds.conf? PHP always segfaults when server not found in config. At least it does for me.

Edit freetds.conf
# A typical Microsoft SQL Server 6.x configuration
       host =
       port = 1433
       tds version = 4.2
$connect_id = mssql_pconnect("MyServer65" , "user" , "abcdefg" );
 [2002-06-18 04:40 UTC]
Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read

Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.

 [2002-06-19 09:47 UTC] jim at dardenhome dot com
I'm having the same problem. RH 7.2/PHP 4.2.1


Program received signal SIGSEGV, Segmentation fault.
__inet_aton (cp=0x0, addr=0xbfffe400) at inet_addr.c:130
130     inet_addr.c: No such file or directory.
        in inet_addr.c
(gdb) bt
#0  __inet_aton (cp=0x0, addr=0xbfffe400) at inet_addr.c:130
#1  0x401edf6f in inet_addr (cp=0x0) at inet_addr.c:96
#2  0x4003c4cb in tds_connect (login=0x816dc68, parent=0x816b658) at login.c:168
#3  0x40034e7f in tdsdbopen (login=0x8163960, server=0x816dba4 "ProcessLog") at dblib.c:442
#4  0x080ab670 in php_sybase_do_connect (ht=3, return_value=0x816dc1c, this_ptr=0x0, return_value_used=0, persistent=0)
    at php_sybase_db.c:535
#5  0x080ab7c9 in zif_sybase_connect (ht=3, return_value=0x816dc1c, this_ptr=0x0, return_value_used=0) at php_sybase_db.c:582
#6  0x080eaa6b in execute (op_array=0x8165ddc) at ./zend_execute.c:1598
#7  0x080d1b36 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at zend.c:810
#8  0x0805f601 in php_execute_script (primary_file=0xbffffab0) at main.c:1381
#9  0x0805d5d0 in main (argc=2, argv=0xbffffb54) at cgi_main.c:778
#10 0x40112507 in __libc_start_main (main=0x805ccf4 <main>, argc=2, ubp_av=0xbffffb54, init=0x805b744 <_init>, fini=0x80ef590 <_fini>, 
    rtld_fini=0x4000dc14 <_dl_fini>, stack_end=0xbffffb4c) at ../sysdeps/generic/libc-start.c:129
 [2002-06-19 10:02 UTC] jim at dardenhome dot com
I figured out the problem. I decided to use the freetds.conf file for configuring the connection rather than the depricated "interfaces" file. I probably had some environment variable not set properly.
 [2002-06-19 10:03 UTC]
Not a PHP bug > bogus
 [2004-04-12 01:08 UTC] swingcoder at msn dot com
what the bug is!
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Jul 18 15:01:29 2024 UTC