Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Fatal error: Allowed memory size...exhausted?


olimits7

Recommended Posts

Hi,

 

I have a custom upload script in Oscommerce that uploads pricing/inventory data from *.txt files to my website, and this upload script has been working fine until recently. In the past I've uploaded 12MB files to my website with no problems, but now when I try to upload the same 12MB file I receive the following error messages:

 

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 35 bytes) in ../database.php on line 349

This part of the code below is what's on line 349: $_time = number_format(($_end[1] + $_end[0] - ($_start[1] + $_start[0])), 6);

function tep_db_query($query, $link = 'db_link') {

global $$link, $debug;
$query_start = microtime();

if (defined('STORE_DB_TRANSACTIONS') && (STORE_DB_TRANSACTIONS == 'true')) {
 error_log('QUERY ' . $query . "\n", 3, STORE_PAGE_PARSE_TIME_LOG);
 }
 $result = mysql_query($query, $$link) or tep_db_error($query, mysql_errno(), mysql_error());

 if (defined('STORE_DB_TRANSACTIONS') && (STORE_DB_TRANSACTIONS == 'true')) {
 $result_error = mysql_error();
 error_log('RESULT ' . $result . ' ' . $result_error . "\n", 3, STORE_PAGE_PARSE_TIME_LOG);
 }

 $_start = explode(' ', $query_start);
 $_end = explode(' ', microtime());
 $_time = number_format(($_end[1] + $_end[0] - ($_start[1] + $_start[0])), 6);
 if ($_time > 0.05)
  error_log($_time.': '.$query."\n\n", 3, 'log.txt');

 $debug['QUERIES'][] = $query;
 $debug['TIME'][] = $_time;
 return $result;
 }

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 103 bytes) in ../vendors.php on line 196

This part of the code is what's on line 196: $products_query

//Check if product exists
$UPCNumber = str_replace("'", "", $UPCNumber);
$products_query = tep_db_query("SELECT products_id, products_price, products_model FROM ".TABLE_PRODUCTS." WHERE products_model = '".tep_db_input($UPCNumber)."'");
$vendors_query = tep_db_query("SELECT wholesale_price, inventory_levels FROM ".TABLE_VENDORS_TO_PRODUCTS." WHERE products_model = '".tep_db_input($UPCNumber)."' AND vendors_id = '".tep_db_input($VendorID)."'");
$vend = tep_db_fetch_array($vendors_query);

 

I had my hosting company increase my PHP "memory_limit" from 128M to 256M, but I still receive the same error.

 

I don't understand 256M is more than enough memory for the PHP "memory_limit", and this did work fine in the past and I haven't made any changes to the upload script either.

 

Does anyone have any ideas of what could be causing this memory size issue??

 

Thank you,

 

olimits7

Link to comment
Share on other sites

  • 2 weeks later...

having the same issue also when I try to run a report - Customers/Products to see how many customers purchased a certain product

 

Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 1048566 bytes) in /home/scrapbox/public_html/catalog/admin/includes/functions/html_output.php on line 290

 

 

I've also had my host increase my memory and that hasn't helped either - any clues would be appreciated?

 

thanks

Maria

Link to comment
Share on other sites

ok I think I have fixed this issue

 

olimits7 try the following

 

go to your vendors.php file and above any existing script - put in

 

ini_set("memory_limit","12M");

 

and then resave your file

 

do the same for database.php

 

 

hope that helps - it fixed my problem :)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...