WooCommerce and Wordpress PHP memory_limit problem - php

I have three WooCommerce based shops installed on my server, basically they are identical shops using the same plugins and themes and the assortment is almost identical (product presentation also).
Each store database has less than 100MB.
In one case I have memory problem for PHP scripts, while memory_limit is set to 256M one store still has memory problems. Others work ok.
[01-May-2020 22:23:08 UTC] PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 14069080 bytes) in /home/shop1/public_html/wp-includes/wp-db.php on line 2951
[01-May-2020 22:33:22 UTC] PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 10489856 bytes) in /home/shop1/public_html/wp-includes/functions.php on line 708
I can raise the memory_limit to e.g. 384M and the problem disappears. But why does such a script require more than 256MB and the other two do not? Is it normal?

You might have a memory leak or from what I can understand if you have set 256M and each one is 100MB that means you only have space for 2 of them and hence the 3rd one is running out of ram.
Make sure that on your php.ini you put more ram and then assign enough ram to each webstore that does not surpass your overall amount.
Your php.ini is most likely taking over and setting the overall RAM rather than the ram PER instance. Hope that makes sense.

Related

Codeigniter: Allowed memory size of 33554432 bytes exhausted ( already using ini_set('memory_limit', '-1'); )

On my localhost, the process in question works fine. It's basically a whole lot of number crunching.
But on my server (CentOS 5.9 + PHP 5 + MySQL 5) it gives me this error:
Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 80 bytes) in {..}/system/database/drivers/mysql/mysql_result.php on line 147
I'm already declaring the following before running this function:
ini_set('memory_limit', '-1');
The system itself has 8 GB of memory. My local machine has 12 GB of memory. I doubt it needs that much memory, though.
Any insights would be greatly appreciated. Thanks in advance!
PHP has a global memory limit on each system where it runs that overrides your program's own memory_limit setting.
It's the memory_limit value in a file called php.ini. Shared hosting providers often set this to something like 32M. That seems to be your problem. If you control the server you may be able to set it larger.
Otherwise you'll need to rework your program to use less memory. (This is a very common problem when moving from development to production, sad to say.)
Here's some advice on finding that file if you don't know where it is.
Dude, where's my php.ini?

Possible to reduce memory footprint when including a PHAR?

In my PHP web application there is this line:
require_once(__DIR__. '/myfiles.phar');
I'm using this to include a self-created PHAR file with ≈8 MB file size.
One customer has a memory_limit setting of 16M.
In this environment, I do receive an error
Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 16777216 bytes) in /var/www/my.php on line 3
(See also e.g. here)
Since the customer cannot increase the memory_limit setting value, I'm clueless on how to adjust this.
My question:
Is there any way to tell the PHAR functions in PHP to use less memory when "extracting" PHAR files?
(I'm guessing the the size of my PHAR file is directly linked to the memory usage. So the obvious but complicated way would be to reduce the size of the PHAR file).

Fatal error: Allowed Memory size of 67108864 in opencart

I'm using opencart. In my admin page when I access CATALOG>PRODUCTS (I have 73 products - Totally I have four pages). When I access my second page it shows this following error
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 4000 bytes) in /home/justborn/public_html/system/library/image.php on line 34
But, I can access first, third and fourth page. I have tried this solution (Allowed memory size of 67108864 bytes exhausted (tried to allocate 4459414 bytes) in writing an xml file) in my .htaccess file
php_value memory_limit 128M
But, it returns 500 Internal error.. How do I solve this Fatal error: Allowed Memory size of 67108864 ?
I have found the Solution
In my admin folder I have a php.ini file
I have changed my memory_limit = 64M; to memory_limit = 128M;. Now it works fine.. I didn't get Fatal Error.
Check your images size in filemanager: there might be some big sized images.
I had 2.9MB size of picture which created such trouble to me.
Now, after reducing the size I've solved it.
Memory limit is more than enough.
It seems that there is some endless loop in the script that is not letting it to terminate.
Look for any for, while, do while loop in the script.
If above remedy does not works, please share code so that issue can be examined further.
you have to change the php.ini file on line 18 memory_limit = 64M; to 64 x 2 = 124 or 64 x 4 = 256 but wait ask your hosting provider does they support higher limit size if yes then it will work otherwise you are wasting your energy
This is the same problem I faced,
"Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 8192 bytes) in opencart system/library/image.php on line 26"
This error appears when we upload large images (1.5 MB+ size), at the time of editing the images Opencart system/library/image.php tries to load those images and in order to load BIG images it needs more memory.
In order solve this there are two ways.
1. For shared hosting users
1.1 Open File Manager from cPanel or FTP to your website
1.2 Go to "public_html/image/catalog"
1.3 Look for Big Images and Download and delete those images from the server.
VPS - Dedicated - Cloud - Server where we can manage php.ini
2.1 In admin folder open php.ini file
2.2 Try to increase from memory_limit = 64M; to memory_limit = 128M; or more as required.
This should solve the problem.
I would personally advice to upload optimized images and use solution 1 that is deleting Big Images, this is not create any load on the server.

Fatal error on memory size (over 64mb?)

I'm getting this error:
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 3456 bytes) in /home/gigiphot/public_html/Includes/thumbnail.inc.php on line 158
and this PHP memory limit is set to 64mb .. do I increase it? Not sure of next step...
You can set memory_limit in your php.ini file, see here: http://php.net/manual/en/ini.core.php
However, you may want to investigate if you really need such a heavy memory consumption... if this service will be used by multiple users concurrently, you may have problems... An unintended high memory consumption is often a symptom of something going wrong in your script.
Try adding ini_set('memory_limit', '128M'); to the top of the file.
You can set it to -1 to ignore the limit, but it's not generally recommended.

PHP ini problem

I have this error in a PHP based installation:
Fatal error: Allowed memory size of
8388608 bytes exhausted (tried to
allocate 98304 bytes) in
D:\vertrigo\VertrigoServ\www\dos\ana\libraries\test\domain\query\query.php
on line 804
I changed my php.ini memory_limit from 8MB to 12MB, however I am still receiving the error.
What is the problem?
Fatal error: Allowed memory size of 8388608 bytes exhausted
8 Megabytes sounds pretty low. WordPress for example will choke on anything under 12 MB even without plugins, and run smoothly with 16 MB or more.
I'm therefore going to boldly guess that your social engine simply needs more memory to run. See for example this answer on how to raise the memory limit: Increase PHP Memory limit (Apache, Drupal6)

Categories