|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2003-03-26 16:18 UTC] wbarnett at ncta dot com
Error:
CGI Error
The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are:
FATAL: emalloc(): Unable to allocate 2012964085 bytes
Note that setting the Setting odbc.defaultlrl = 131072 (as high as I needed to go methinks) works just fine.
Cant get a GDB Backtrace.
Script that generates:
<?php
$DBName='SpamGenerator';
$DBUser='Admin';
$DBPass='';
function ODBCConnect(){
global $DBName;
global $DBUser;
global $DBPass;
$cnx=odbc_connect($DBName, $DBUser, $DBPass);
return $cnx;
}
function GenerateMainTable(){
$cnx=ODBCConnect();
$strSQL="SELECT MailID, MailName, MailDate FROM sysMail";
if (isset($_GET['SortOrder'])){
$SortOrder=$_GET['SortOrder'];
$strSQL.=" ORDER BY $SortOrder";
}
$cur=odbc_exec($cnx, $strSQL);
$TableDef="<td class=\"Main\">";
while (odbc_fetch_row($cur)){
$MailID=odbc_result($cur, "MailID");
$MailName=odbc_result($cur, "MailName");
$MailDate=date('m.d.y', strtotime(odbc_result($cur, "MailDate")));
echo "<tr>$TableDef<center><a href=\"MailDetail.php?MailID=$MailID\">$MailID</center></td>$TableDef $MailName </td>$TableDef<center>$MailDate</center></td></tr>";
}
odbc_close($cnx);
}
GenerateMainTable();
?>
Data it is pulling is pretty simple--an integer ID, a string for name and a date value.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 06:00:01 2025 UTC |
hit exactly the same problem while trying to connect to MSSQL Server ! my software: PHP: php 4.3.2 unixODBC: 2.2.5 freeTDS: 0.6.1 on Linux the problem was, that the result-struct was reused for all queries i send to db ... so i didnt run into any problem, till the next querie had more or same count of columns, but it crashed as i tried to fetch data for a 3-column query right after i executed a 18-column query. doh. hunted it till i found a solution: in ext/odbc/php_odbc.c i added a line in function ========================================================= PHP_FUNCTION(odbc_execute) { .... /* Close cursor, needed for doing multiple selects */ rc = SQLFreeStmt(result->stmt, SQL_CLOSE); if (rc == SQL_ERROR) { odbc_sql_error(result->conn_ptr, result->stmt, "SQLFreeStmt"); } rc = SQLExecute(result->stmt); // // IMPORTANT !! driver dont seems to set numcols here .. result->numcols = 0; ======================================================== perhaps this should be done in SQLFreeStmt ... i dont know exactly finaly this works for me ... perhaps this can help you