Skip to Content.
Sympa Menu

freetds - [freetds] PHP+Sybase Problem

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Raul Elizondo Leal <rauleli AT juarez.gob.mx>
  • To: freetds AT lists.ibiblio.org
  • Subject: [freetds] PHP+Sybase Problem
  • Date: Tue, 19 Dec 2006 09:44:13 -0700

Hi

This is my first experience with php and also with sybase, but got
enough knowledge in linux to compile, test and run things.

I downloaded freeTDS tarball and compiled it without any problems. I
got the source rpm of php of a FC6 to reconfigure it and recompile it.
I took the ./configure string that comes in the phpinfo() and i added
--with-sybase. I also tried using --with-sybase-ct.

In both cases, my guess is that it falls into a endless loop that takes
all memory of php. No matter if i increment the memory_limit in
php.ini, i get this error in the apache error log:

[Mon Dec 18 14:37:12 2006] [error] [client 192.168.1.252] PHP Fatal
error: Allowed memory size of 16777216 bytes exhausted (tried to
allocate 24 bytes) in /var/www/html/sample.php on line 15

My sample.php is quite simple, and its only intended to display 2 fields
of the table.

--------
<html>
<body>
<?php

# echo ("Ponemos algunas variables de ambiente<br>\n");
# putenv("TDSDUMP=/tmp/tdsdump.log");
# putenv("TDSDUMPCONFIG=/tmp/tdsdumpconfig.log");


$connection =
sybase_connect("testingserver","testinguser","testingpass");
$db = sybase_select_db("testingdb", $connection);

$sql = "SELECT fieldone,fiendtwo from testingtable where fieldtwo =
'L'";

$sql_result = sybase_query($sql,$connection);

while ($row = sybase_fetch_array($sql_result)) {
echo $row["fieldone"];
echo " ";
echo $row["fieldtwo"];
echo "<br>\n";
}

sybase_free_result($sql_result);
sybase_close($connection);
?>

</body>
</html>
-----------

the line where i get the error is in the one with "sybase_query"
command. The table has no more than 800 records, and ten short fields.

When dumping process using TDSDUMP, i dont see when it ends, it just
keep storing the pattern shown bellow:

-------
dblib.c:2486:leaving dbdatlen() returning 8
dblib.c:1620:dbconvert(62 [SYBFLT8] len 8 => 47 [SYBCHAR] len 28)
dblib.c:1760:dbconvert() calling tds_convert
dblib.c:1763:dbconvert() called tds_convert returned 6
dblib.c:1866:dbconvert() outputting 6 bytes character data destlen = 28
dblib.c:2480:dbdatlen() type = 47
dblib.c:2486:leaving dbdatlen() returning 1
dblib.c:2480:dbdatlen() type = 47
dblib.c:2486:leaving dbdatlen() returning 1
dblib.c:1433:dbnextrow()
dblib.c:1447:dbnextrow() dbresults_state = 2
dblib.c:1509:leaving dbnextrow() returning -3
dblib.c:2480:dbdatlen() type = 39
dblib.c:2486:leaving dbdatlen() returning 23
dblib.c:2480:dbdatlen() type = 39
dblib.c:2486:leaving dbdatlen() returning 23
dblib.c:2480:dbdatlen() type = 39
dblib.c:2486:leaving dbdatlen() returning 10
dblib.c:2480:dbdatlen() type = 39
dblib.c:2486:leaving dbdatlen() returning 10
dblib.c:2480:dbdatlen() type = 39
dblib.c:2486:leaving dbdatlen() returning 0
dblib.c:2480:dbdatlen() type = 39
dblib.c:2486:leaving dbdatlen() returning 31
dblib.c:2480:dbdatlen() type = 39
dblib.c:2486:leaving dbdatlen() returning 31
dblib.c:2480:dbdatlen() type = 109
dblib.c:2486:leaving dbdatlen() returning 8
convert.c:2776:tds_willconvert()
convert.c:2780:tds_willconvert() 62 47 1
dblib.c:2480:dbdatlen() type = 109
--------

Just got stock, any help, hint, advice will be apreciated.

Regards,

-=Raul=-




  • [freetds] PHP+Sybase Problem, Raul Elizondo Leal, 12/19/2006

Archive powered by MHonArc 2.6.24.

Top of Page