Opencart error code with exhausted memory

126 views Asked by At

I am currently getting the following error code in my logs regarding exhausted memory.

[16-May-2023 11:18:05 UTC] PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 33554440 bytes) in /home/allgates/public_html/vqmod/vqmod.php on line 336

The code this is referring to is below

`    * VQMod::_loadChecked()
     *
     * @return null
     * @description Loads already checked files and adds them to _doNotMod array
     */
    private static function _loadChecked() {
        $file = self::path(self::$checkedCache);
        if($file && is_file($file)) {
Line 336 ->     **  **$paths = file($file, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);****
            if(!empty($paths)) {
                foreach($paths as $path) {
                    $fullPath = self::path($path, true);
                    if($fullPath) {
                        self::$_doNotMod[] = $fullPath;`

Can anyone advise how to fix? I have no idea with php, so hoping someone knows an easy fix.

I have checked my memory limit in the php.ini file and it's showing as 64M.I increased to 128M but I was still getting the error.

2

There are 2 answers

1
Andrés Javier Pavón Fernández On

The error message you're seeing indicates that the memory limit for your PHP script has been exceeded. Specifically, the file function in PHP is consuming a large amount of memory due to the size of the file being read. To resolve this issue, you can try increasing the memory limit for your script.

To do this, you can either edit the php.ini file directly or modify the .htaccess file for your website.

Here are the steps you can take:

  • Edit php.ini: Locate the "memory_limit" directive in the php.ini file and increase the value, such as "memory_limit = 256M" for 256 megabytes of memory.

  • Edit .htaccess: If you don't have access to php.ini, you can try editing the .htaccess file in your website's root directory and add the following line: "php_value memory_limit 256M" (or the desired value).

I hope this helps you resolve the issue.

0
Graeme Harvey On

The 'checked.cache' file was growing continuously caused by cache misses for absolute paths. Fixed the vqmod::path() function to handle absolute paths.