Jump to content

Memory Leak


Phpnewbie23

Recommended Posts

Hi Guys

 

Hopefully someone can help me i thought. TODAY i will have finshed my first PHP project but i get this error.

 

 

PHP Fatal error: Out of memory (allocated 262144) (tried to allocate 4294967293 bytes) in C:\Inetpub\wwwroot\Backup-Report\index.php on line 96

 

 

Please help me ..... have changed my memory limit in the php.ini and dont know what else to do

 

HELP.......

Link to comment
Share on other sites

Please help me ..... have changed my memory limit in the php.ini and dont know what else to do

 

HELP.......

 

And how are we supposed to do that with the lack of information?  Like everyone else said, we need to know what you're doing.  Obviously you're doing a Backup-Report of something but what?  We also need to know how you're doing it.  I have run into this problem before and had to use sort of a recursive method solve this problem.  Please provide code so we can further assist you.

Link to comment
Share on other sites

Here is the the PHP code

 

<?php

include 'bytes.php';
//include 'smtp.php';
$color1 = "#FFFFCC"; 
$color2 = "#FFFFFF"; 
$row_count = 0;

$conn=odbc_connect('STOREGRID','','');
if (!$conn)
  {exit("Connection Failed: " . $conn);}
$sql="SELECT * FROM INCREMENTAL_BACKUP_REPORT";
$rs=odbc_exec($conn,$sql);
if (!$rs)
  {exit("Error In SQLITE Connection To Database");}

$row_color = ($row_count % 2) ? $color1 : $color2;

echo "<table id='table'>";
echo "<tr>";
echo "<th align=center><small>Client</small</th>";
echo "<th align=center><small>Backup Name</small></th>";
echo "<th align=center><small>Start Time</small></th>";
echo "<th align=center><small>End Time</small></th>";
echo "<th align=center><small>Skipped Files</small></th>";
echo "<th align=center><small>Files Added</small></th>";
echo "<th align=center><small>Files Deleted</small></th>";
echo "<th align=center><small>Files Modified</small></th>";
echo "<th align=center><small>Orignal File Size</small></th>";
echo "<th align=center><small>Disk Space Used</small></th>";
echo "<th align=center><small>Bandwidth Used</small></th>";
echo "<th align=center><small>Backup Status</small></th>";
echo "</tr>";


   while (odbc_fetch_row($rs))
{
$row_color = ($row_count % 2) ? $color1 : $color2;

  $client=odbc_result($rs,"CLIENT_NAME");
   $backupname=odbc_result($rs,"BACKUP_NAME");
   $start_time=odbc_result($rs,"BACKUP_START_TIME");
   $end_time=odbc_result($rs,"BACKUP_END_TIME");
   $skipfiles=odbc_result($rs,"NO_OF_FILES_SKIPPED");
   $filesadded=odbc_result($rs,"NO_OF_FILES_ADDED");
   $filedeleted=odbc_result($rs,"NO_OF_FILES_DELETED");
   $filemodified=odbc_result($rs,"NO_OF_FILES_MODIFIED");
   $fileoriginal=odbc_result($rs,"ORIGINAL_FILE_SIZE");
   $diskspace=odbc_result($rs,"DISK_SPACE_USED");
   $bandwidth=odbc_result($rs,"BANDWIDTH_USED");
   $remarks=odbc_result($rs,"REMARKS");

echo "<tr>";
echo "<td bgcolor=$row_color nowrap align=center><small>$client</small></td>","\n";
echo "<td bgcolor=$row_color align=center><small>$backupname</small></td>","\n";
echo "<td bgcolor=$row_color align=center><small>" . date("l d/m/Y H:i:s", $start_time) . "</small></td>","\n";
echo "<td bgcolor=$row_color align=center><small>" . date("l d/m/Y H:i:s", $end_time) . "</small></td>","\n";
echo "<td bgcolor=$row_color align=center><small>$skipfiles</small></td>","\n";
echo "<td bgcolor=$row_color align=center><small>$filesadded</small></td>","\n";
echo "<td bgcolor=$row_color align=center><small>$filedeleted</small></td>","\n";
echo "<td bgcolor=$row_color align=center><small>$filemodified</small></td>","\n";
echo "<td bgcolor=$row_color align=center><small>". ByteSize($fileoriginal) . "</small></td>","\n";
echo "<td bgcolor=$row_color align=center><small> ". ByteSize($diskspace) . "</small></td>","\n";
echo "<td bgcolor=$row_color align=center><small>". ByteSize($bandwidth) . "</small></td>","\n";
if ($remarks=="Success"){
echo "<td bgcolor=$row_color align=center><small><a href=\"javascript:void(0);\"<img border'0' src='./images/success-icon.gif' align='center' onmouseover=\"return overlib('$remarks',STICKY, MOUSEOFF);\"></a> \n";
}else
    
if ($remarks=="Backup Completed Partially."){

echo "<td bgcolor=$row_color align=center><small><a href=\"javascript:void(0);\"<img border'0' src='./images/warning-icon.gif' align='center' onmouseover=\"return overlib('$remarks',STICKY, MOUSEOFF);\"></a> \n";
}else{
echo "<td bgcolor=$row_color align=center><small><a href=\"javascript:void(0);\"<img border'0'src='./images/error-icon.gif' align='center' onmouseover=\"return overlib('$remarks',STICKY, MOUSEOFF);\"></a> \n"; 

echo "</tr>";
}
$row_count++;
}
echo "</table>";

echo"<br>";



odbc_close($conn);

 

The php code connects to a ODBC sqlite database  collects the information and provides it in a table for the user to view.

 

Thanks

 

James

Link to comment
Share on other sites

And since the posted code does not have 96 lines in it, it is unlikely that it is the one the error mentions - in C:\Inetpub\wwwroot\Backup-Report\index.php on line 96

 

To get the fasted solution, you need to communicate the information you have in your possession that is relevant to the problem.

Link to comment
Share on other sites

That was just the PHP code thats why there is not 96 lines.

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<title>Vembu StoreGrid Backup Moniter</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" href="styles.css" type="text/css" />
    <script type="text/javascript" language="JavaScript" src="./javascript/overlib.js"></script>   
      <script type="text/javascript" language="JavaScript" src="./javascript/overlib_positioncap.js"></script>   
      <script type="text/javascript" language="JavaScript" src="./javascript/overlib_centerpopup.js"></script>
      <script type="text/javascript" language="JavaScript" src="./javascript/overlib_followscroll.js"></script>  
</head>

<body>
<div id="overDiv" style="position:absolute; visibility:hidden; z-index:10000;"></div>

<h1>Goldfield Backup Schedule <?php echo date("d/m/Y"); ?> </h1>
<hr />
<div id="menucase">
  <div id="stylefour">
    <ul>
      	  	  <li><a href="http://www.vembu.com/" target="_blank">Vembu Website </a></li>
  <li><a href="http://www.vembu.com/forum/viewforum.php?f=1" target="_blank">Vembu Forum</a></li>
  <li><a href="http://www.vembu.com/technical-support.html" target="_blank">Vembu Support</a></li>
  <li><a href="SQLMoveLog.php">SQL Copy Log</a></li>
  <li><a href="Tools.php">Tools/Links (Under Construction)</a></li>

              </ul>
  </div>
</div>

<br>


<p>
Welcome to the Goldfield backup moniter. This moniter enables you to establish which clients have backed up or have not. If you have any problem please 
<a style="color: #000000" href= "mailto:james@goldfieldltd.com?subject=Vembu-Moniter"><u>click here</u>  to contact me.</a><br />

<br>
<u>Key:</u>
<br />
<br />
<img src="./images/success-icon.gif">
  Passed.
<img src="./images/warning-icon.gif">
  Backup Completed Partially.
<img src="./images/error-icon.gif"> 
  Failed.

<br />
<br />
</p>

<br>

<?php

include 'bytes.php';
//include 'smtp.php';
$color1 = "#FFFFCC"; 
$color2 = "#FFFFFF"; 
$row_count = 0;

$conn=odbc_connect('STOREGRID','','');
if (!$conn)
  {exit("Connection Failed: " . $conn);}
$sql="SELECT * FROM INCREMENTAL_BACKUP_REPORT";
$rs=odbc_exec($conn,$sql);
if (!$rs)
  {exit("Error In SQLITE Connection To Database");}

$row_color = ($row_count % 2) ? $color1 : $color2;

echo "<table id='table'>";
echo "<tr>";
echo "<th align=center><small>Client</small</th>";
echo "<th align=center><small>Backup Name</small></th>";
echo "<th align=center><small>Start Time</small></th>";
echo "<th align=center><small>End Time</small></th>";
echo "<th align=center><small>Skipped Files</small></th>";
echo "<th align=center><small>Files Added</small></th>";
echo "<th align=center><small>Files Deleted</small></th>";
echo "<th align=center><small>Files Modified</small></th>";
echo "<th align=center><small>Orignal File Size</small></th>";
echo "<th align=center><small>Disk Space Used</small></th>";
echo "<th align=center><small>Bandwidth Used</small></th>";
echo "<th align=center><small>Backup Status</small></th>";
echo "</tr>";


   while (odbc_fetch_row($rs))
{
$row_color = ($row_count % 2) ? $color1 : $color2;

  $client=odbc_result($rs,"CLIENT_NAME");
   $backupname=odbc_result($rs,"BACKUP_NAME");
   $start_time=odbc_result($rs,"BACKUP_START_TIME");
   $end_time=odbc_result($rs,"BACKUP_END_TIME");
   $skipfiles=odbc_result($rs,"NO_OF_FILES_SKIPPED");
   $filesadded=odbc_result($rs,"NO_OF_FILES_ADDED");
   $filedeleted=odbc_result($rs,"NO_OF_FILES_DELETED");
   $filemodified=odbc_result($rs,"NO_OF_FILES_MODIFIED");
   $fileoriginal=odbc_result($rs,"ORIGINAL_FILE_SIZE");
   $diskspace=odbc_result($rs,"DISK_SPACE_USED");
   $bandwidth=odbc_result($rs,"BANDWIDTH_USED");
   $remarks=odbc_result($rs,"REMARKS");

echo "<tr>";
echo "<td bgcolor=$row_color nowrap align=center><small>$client</small></td>","\n";
echo "<td bgcolor=$row_color align=center><small>$backupname</small></td>","\n";
echo "<td bgcolor=$row_color align=center><small>" . date("l d/m/Y H:i:s", $start_time) . "</small></td>","\n";
echo "<td bgcolor=$row_color align=center><small>" . date("l d/m/Y H:i:s", $end_time) . "</small></td>","\n";
echo "<td bgcolor=$row_color align=center><small>$skipfiles</small></td>","\n";
echo "<td bgcolor=$row_color align=center><small>$filesadded</small></td>","\n";
echo "<td bgcolor=$row_color align=center><small>$filedeleted</small></td>","\n";
echo "<td bgcolor=$row_color align=center><small>$filemodified</small></td>","\n";
echo "<td bgcolor=$row_color align=center><small>". ByteSize($fileoriginal) . "</small></td>","\n";
echo "<td bgcolor=$row_color align=center><small> ". ByteSize($diskspace) . "</small></td>","\n";
echo "<td bgcolor=$row_color align=center><small>". ByteSize($bandwidth) . "</small></td>","\n";
if ($remarks=="Success"){
echo "<td bgcolor=$row_color align=center><small><a href=\"javascript:void(0);\"<img border'0' src='./images/success-icon.gif' align='center' onmouseover=\"return overlib('$remarks',STICKY, MOUSEOFF);\"></a> \n";
}else
    
if ($remarks=="Backup Completed Partially."){

echo "<td bgcolor=$row_color align=center><small><a href=\"javascript:void(0);\"<img border'0' src='./images/warning-icon.gif' align='center' onmouseover=\"return overlib('$remarks',STICKY, MOUSEOFF);\"></a> \n";
}else{
echo "<td bgcolor=$row_color align=center><small><a href=\"javascript:void(0);\"<img border'0'src='./images/error-icon.gif' align='center' onmouseover=\"return overlib('$remarks',STICKY, MOUSEOFF);\"></a> \n"; 

echo "</tr>";
}
$row_count++;
}
echo "</table>";

echo"<br>";



odbc_close($conn);
?>

</body>
</html>



 

The INCREMENTAL_BACKUP_REPORT  table is 4403 records.

 

Cheers james 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.