Phpnewbie23 Posted February 19, 2009 Share Posted February 19, 2009 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....... Quote Link to comment https://forums.phpfreaks.com/topic/145954-memory-leak/ Share on other sites More sharing options...
allworknoplay Posted February 19, 2009 Share Posted February 19, 2009 1) what the heck were you even trying to do? 2) show us some code perhaps? 3) what is your environment setup like? do you own the server? hosting it? come on, help us out here if you want help... Quote Link to comment https://forums.phpfreaks.com/topic/145954-memory-leak/#findComment-766234 Share on other sites More sharing options...
milesap Posted February 19, 2009 Share Posted February 19, 2009 Does your scripts contain any loop functions like while() foreach() or for()? If so you may have an infinite loop which is causing this error. Quote Link to comment https://forums.phpfreaks.com/topic/145954-memory-leak/#findComment-766238 Share on other sites More sharing options...
Mark Baker Posted February 19, 2009 Share Posted February 19, 2009 tried to allocate 4294967293 bytes If PHP is trying to grab that much memory in one go, it's likely to be trying to read an exceptionally large file (XML, image, whatever) into memory in one go Quote Link to comment https://forums.phpfreaks.com/topic/145954-memory-leak/#findComment-766242 Share on other sites More sharing options...
Maq Posted February 19, 2009 Share Posted February 19, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/145954-memory-leak/#findComment-766255 Share on other sites More sharing options...
Phpnewbie23 Posted February 19, 2009 Author Share Posted February 19, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/145954-memory-leak/#findComment-766316 Share on other sites More sharing options...
allworknoplay Posted February 19, 2009 Share Posted February 19, 2009 And how big is this INCREMENTAL_BACKUP_REPORT table? Quote Link to comment https://forums.phpfreaks.com/topic/145954-memory-leak/#findComment-766322 Share on other sites More sharing options...
PFMaBiSmAd Posted February 19, 2009 Share Posted February 19, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/145954-memory-leak/#findComment-766367 Share on other sites More sharing options...
Phpnewbie23 Posted February 20, 2009 Author Share Posted February 20, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/145954-memory-leak/#findComment-766923 Share on other sites More sharing options...
redarrow Posted February 20, 2009 Share Posted February 20, 2009 Read this mate, might help. http://www.php-mysql-tutorial.com/wikis/mysql-tutorials/using-php-to-backup-mysql-databases.aspx Quote Link to comment https://forums.phpfreaks.com/topic/145954-memory-leak/#findComment-766931 Share on other sites More sharing options...
Phpnewbie23 Posted February 23, 2009 Author Share Posted February 23, 2009 Does anyone know how i could resolve this please.... Cheers phpnewbie Quote Link to comment https://forums.phpfreaks.com/topic/145954-memory-leak/#findComment-768970 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.