Segmentation fault when calling mssql_execute

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
tomatchili
Forum Newbie
Posts: 1
Joined: Mon Jun 21, 2010 3:56 am

Segmentation fault when calling mssql_execute

Post by tomatchili »

Hi all,
I have problem running a php script on Ubuntu 8.04 Server, but it works on Ubuntu 9.10 Desktop

On Ubuntu 8.04 the php call: mssql_execute returns Segementation Fault. I have debugged it using gdb and noticed that it is the call to dbrpcexec that fails: (please not that this is defined to dbrpcsend in a include.h file)

I use the the same odbc and freetds konfiguration:
odbc.init:

Code: Select all

[MSSQLdatabase]
Description = Octus Database
Driver = FreeTDS
Trace = No
Servername = SQLServer #refers to the SQLServer in /etc/freetds.conf
Port = 1433
Database = mdb_staging
freetds.

Code: Select all

text size = 64512 (also tested with 564512)


[SQLServer]
    host = XXX.XXX.XXX.XXX
    port = 1433
    tds version = 8.0
    client charset = UTF-8
The code:

Code: Select all

// Connect to MSSQL and select the database 
$link=mssql_connect("SQLServer", "user", "password"); 
if (!$link) { 
    die('Something went wrong while connecting to MSSQL'); 
} 
 
 
mssql_select_db('mdb_staging'); 
 
$startExport= mssql_init("StartNewExport"); 
$res = mssql_query( "delete ci_asset_lms", $link) or die("Could not delete"); 
 
mssql_free_result($res); 
 // the mssql_free call fails with error: 
//Warning: mssql_free_result(): supplied argument is not a valid MS SQL-result resource in /home/gui-server/from_melloman/sync_lms_to_amigo.php on line 536
// On both servers


//Define Parameters 
$sp_sparram->param1= 'ci_asset_lms'; 
$sp_sparram->parm2 = 'system_lms'; 
$sp_sparram->parm3 = ''; 
 
//Load Parameters 
mssql_bind($startExport, '@import_type', $sp_sparram->param1, SQLTEXT, false); 
//mssql_bind($startExport, '@creator', $sp_sparram->parm2, SQLTEXT, false); 
//mssql_bind($startExport, '@import_id', $sp_sparram->parm3, SQLINT4, true); 

mssql_execute($startExport); 
and the mssql_execute command returns "segmentetion fault"


Any suggestions?
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Re: Segmentation fault when calling mssql_execute

Post by Weirdan »

Post the backtrace.
Post Reply