PHP CLI MSSQL crash

Victor Volpe <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
Hi, the PHP script below are running fine in webserver but not in CLI. Maybe PHP are passing invalid pointers to the dbopen() function of FreeTDS.

Ps.: No output in the FreeTDS debug file and the tsql are running fine. Submited to the PHP Bug Tracking System too: https://bugs.php.net/bug.php?id=69184

Any help will be appreciated.

Test script:
<?php
if (mssql_connect("100.100.100.100", "sa", "thisissparta"))
print "Connection success\n";
else
print "Connection error\n";
?>

Actual result:
(gdb) run test.php
Starting program: /usr/bin/php test.php
[New LWP 100886]
[New Thread 808c06400 (LWP 100886/php)]

Program received signal SIGBUS, Bus error.
[Switching to Thread 808c06400 (LWP 100886/php)]
0x0000000801cc3f7a in dbopen () from /usr/local/lib/libsybdb.so.5
(gdb) bt
#0 0x0000000801cc3f7a in dbopen () from /usr/local/lib/libsybdb.so.5
#1 0x0000000801c9da97 in tdsdbopen () from /usr/local/lib/libsybdb.so.5
#2 0x000000080635a1c1 in getpwent () from /lib/libc.so.7
#3 0x00000008063591b0 in getpwent_r () from /lib/libc.so.7
#4 0x000000080636ce2f in nsdispatch () from /lib/libc.so.7
#5 0x0000000806359c1e in getpwuid_r () from /lib/libc.so.7
#6 0x0000000801cd1978 in dbopen () from /usr/local/lib/libsybdb.so.5
#7 0x0000000801cc4cfd in dbopen () from /usr/local/lib/libsybdb.so.5
#8 0x0000000801cc3f85 in dbopen () from /usr/local/lib/libsybdb.so.5
#9 0x0000000801c9da97 in tdsdbopen () from /usr/local/lib/libsybdb.so.5
#10 0x00000000006c77df in php_mssql_do_connect () at php_mssql.c:793
#11 0x00000000008ca887 in zend_do_fcall_common_helper_SPEC (execute_data=0x808c42100) at zend_vm_execute.h:558
#12 0x0000000000889bf8 in execute_ex (execute_data=<value optimized out>) at zend_vm_execute.h:363
#13 0x0000000000860da0 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at zend.c:1341
#14 0x0000000000804f8c in php_execute_script (primary_file=0x7fffffffe868) at main.c:2578
#15 0x00000000008e6ccc in do_cli (argc=<value optimized out>, argv=<value optimized out>) at php_cli.c:994
#16 0x00000000008e59ba in main (argc=<value optimized out>, argv=<value optimized out>) at php_cli.c:1378

OS: FreeBSD 10.1-RELEASE-p6
PHP: 5.6.6
FreeTDS: 0.91.103_2,1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.