Mysqli.php Error - Fatal Error: Out Of Memory

Fatal error: Out of memory (allocated 25952256) (tried to allocate 1561 bytes) in /home/anemona/public_html/app/Tygh/Backend/Database/Mysqli.php on line 88

Hello,

I have this error on my website, it appear from time to time. I report it to my hosting service (I have a VPS) and they increase the php memory_limit to 512Mb, but the problem persists.

I have cs-cart 4.3.2., I had the previous version and I just made the update, but the error is still here.

Please help me, my customers are unable to finish an order.

This error appear about 3 days ago, I did not do anything, I did not install anything, etc...

The lines 79-92 from the file:

    /**
     * Fetches row from query result set
     * @param  mixed  $result result set
     * @param  string $type   fetch type - 'assoc' or 'indexed'
     * @return array  fetched data
     */
    public function fetchRow($result, $type = 'assoc')
    {
        if ($type == 'assoc') {
            return $result->fetch_assoc();
        } else {
            return $result->fetch_row();
        }
    }

My config.local.php has the following lines:

// Set maximum memory limit
if (PHP_INT_SIZE == 4 && (substr(ini_get('memory_limit'), 0, -1) < "64")) {
  // 32bit PHP
  @ini_set('memory_limit', '512M');
} elseif (PHP_INT_SIZE == 8 && (substr(ini_get('memory_limit'), 0, -1) < "256")) {
  // 64bit PHP
  @ini_set('memory_limit', '512M');
}

if (!defined(‘CONSOLE’)) {
// Set maximum time limit for script execution.
@set_time_limit(3600);
}

I tried to change it to 64/128/256... all the combinations, no changes!

Thanks!

Try to put this line:

 @ini_set('memory_limit', '512M');

before this one:

if (!defined('CONSOLE')) {

So the line should not be in the if..else.. part of code

I put:

// Set maximum memory limit
if (PHP_INT_SIZE == 4 && (substr(ini_get('memory_limit'), 0, -1) < "64")) {
  // 32bit PHP

} elseif (PHP_INT_SIZE == 8 && (substr(ini_get(‘memory_limit’), 0, -1) < “256”)) {
// 64bit PHP
@ini_set(‘memory_limit’, ‘512M’);
}

@ini_set(‘memory_limit’, ‘512M’);
if (!defined(‘CONSOLE’)) {
// Set maximum time limit for script execution.
@set_time_limit(3600);
}

and

// Set maximum memory limit
if (PHP_INT_SIZE == 4 && (substr(ini_get('memory_limit'), 0, -1) < "64")) {
  // 32bit PHP
@ini_set('memory_limit', '512M');
} elseif (PHP_INT_SIZE == 8 && (substr(ini_get('memory_limit'), 0, -1) < "256")) {
  // 64bit PHP

}

@ini_set(‘memory_limit’, ‘512M’);

if (!defined(‘CONSOLE’)) {
// Set maximum time limit for script execution.
@set_time_limit(3600);
}

No changes on the first variant, the secondvariant is worse!

Thanks!