when I try to add new post, after clicking "publish" I have this fatal error:
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 71 bytes) in /XXX/wp-includes/meta.php on line 776.
I spoken with my server admin and he can't give me more memory, so I tried to optimize WP by plugin WP-Optimize but this din't help.
I think wordprass is a good choice with alot of posts. Right now I have in wp_posts 5423 and wp_postmeta 32734 rows.(The website exists less than 1 year)
Any suggestion can be helpful.Thanks!
WP-Optimize won't solve your issue because its job is to clean the database.
You're PHP error has to do with the PHP Memory Limit.
If you have access to the code, then add the following in the "index.php" file of your Wordpress folder:
ini_set("memory_limit","128M");
If you have access to the server's "php.ini" file, then change the following:
memory_limit = 128M
It doesn't matter how big your database is. It's failing because your posting "probably" too much data (images, videos etc.) and it's going through a loop filling the memory, and when it reaches the limit, the script fails.
If it occurs every time you try to write a post, then you might want to look into the Wordpress plugins and their performance.
Related
I am a WordPress beginner and I have only rudimentary knowledge about CSS and HTML. I have built a WordPress blog in the last days, and it was working well. But since two days I couldn't login and couldn't open the page (but I haven't touch the page since about one week, I don't know what happened). This is what was shown:
Fatal error: Allowed memory size of 50331648 bytes exhausted (tried to allocate 30720 bytes) in /home/u0087038969/public_html/wp-admin/includes/deprecated.php on line 533
I suggested that one of the installed plugins caused this trouble. That's why I changed the name of the plugin file via FileZilla, so that I get access to WordPress again. Then I tried to reactivate the plugins gradually to find the trouble-maker. Still it's not really working. What can I do to go about solving the problem?
p.s. I used the following wp plugins: mail poet, all in one seo and contact form 7.
The problem is your installation is requiring more memory than you have available for your site. If you are using a shared hosting environment, you might be at a loss in increasing your memory allotment.
Try updating your wp-config file:
define('WP_MEMORY_LIMIT', '256MB');
If you can change your PHP.ini file you can adjust this:
php_value memory_limit 256MB
Your host seems to have this set incredibly low if it's giving you a memory error at 50MB.
I ran into this rather annoying issue the other day; when a page tries to load it will just 'stop' half way through returning half a page to the end user. The exact error is shown below.
[03-Jul-2015 03:15:04 Europe/London] PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 18996 bytes) in [path]/concrete/vendor/imagine/imagine/lib/Imagine/Gd/Image.php on line 602
I spoke to my host and they bumped up PHP's memory to 512M (which is a bit overkill) yet it still throws this error. I'm not sure if it's a memory leak in Concrete5 somewhere or if it is just the server that the site is hosted on.
Any suggestions are much appreciated.
Edit: Forgot to mention I'm running 1.7.4.2
Edit 2: For reference the exact function is imagecreatetruecolor()
Either:
ini_set('memory_limit','256M');
Inside PHP or getting your host to bump up the memory limit will do the trick.
The problem is very very weird. Let me explain a little bit better - We have a multi site built for the client. Until recently we could edit the homepage with no issues. In the meantime we have upgraded the core (it was still working with new core). Just recently whenever I try to edit the homepage I get this error
Fatal error: Out of memory (allocated 42467328) (tried to allocate 64 bytes) in /home/officete/public_html/wp-includes/wp-db.php on line 1557
Ok so the apparent solution was to change the php memory allowance... Well I have increased it on the server via WHM, increased it in htaccess, wp-config and php.ini file to over 1.2GB (never really expected I will have to increase it so much) just for testing reasons. Every time I try to edit the page I get the same god damn error and 42467328 allocation limit doesn't change at all the " 64 bytes" part does though and its between 32-128 bytes so far.
I am stumped. And have no idea what else I can do. I did contact the server provider they say it looks ok from their end.
I am assuming its the amount of data that is being collected it does contain few ACF repeater fields (15 of them... I know... But I haven't built it). I did disable all the plugins the error persists (I know that disabling them don't really change what is being pulled from db).
BTW The line 1557 is the return result function that returns the query in an array.
you page need more execution time.add below code into config file and try:
define('WP_MEMORY_LIMIT', '128M');
I want to share something that happened to me on the way.
I uploaded an image to my website and after that I created some thumbs. Those thumbs where being cropped automatically from relatively big files (jpeg images of about 5mb), and I was doing that lots of times. Suddenly, when uploading a big file and doing a thumb from a cropped image (not the original), I found out this error:
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 22464 bytes)
How could I exhaust 128Mb of memory?
The main problem was I was using more memory than the available. The first thing to check was, of course, if I was uploading a correct file and not one too big. Ok, 3Mb. Then, which was the problem?
Normally, this kind of error comes with the exact line where it completely depletes your available memory. In my case, was inside this one:
$orig = imagecreatefromjpeg($fullPathFilename);
So, the server crashed when allocating a new image into memory. And then, this came to my mind: I didn't free any of the previous allocation calls! As aforementioned, I happened to generate lots of thumbs from multiple sized images. And silly me, I didn't free any of those. So, if you happen to see this error when you crop/resize/alter multiple images, check for this call inside your code:
imagedestroy($orig);
So, to sum up.
If you don't find the imagedestroy() function, then you may have found your problem!
I have also encounted with this problem
Increase the following variables so that your page execution will not stop:
max_input_time
memory_limit
max_execution_time
Cheers
When I login to my web application it shows an error like:
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 87 bytes) in /gt/2.ps.fo/home/hft/domains/console.fo.spalgo.com/public_html/cake/libs/model/datasources/dbo/dbo_mysql.php on line 775
Is there any solution to solve this problem? Why do I get this error?
That sounds like you've allocated more memory than PHP will allow. Edit the memory_limit setting in your site php.ini configuration as described on the linked page.
Another possibility (less likely) is that you've hit the setrlimit(2) resource limits for your user or group. Check /etc/security/limits.conf for limits that might be set for your web server, along with whatever initialization scripts start your server environment and PHP interpreter environment.
The first example I found by searching SO for "PHP out of memory" is this one
Try using echo instead of storing what you are printing to a variable first.
Looking at the file that threw the fatal exception (dbo_mysql.php) I presume that your call is retrieving data from the DataBase.
Also, looking at the memory limit, it shows 134217728 bytes, which is 128MB, so I think that whatever your API call is doing, is trying to fetch a lot of data which total surpasses the limit allocated per script.
For example, if the last script in the API call stack were to use 20MB for its needs and then tires to fetch data from the DB worth 115MB, your script would be trying to allocate 135MB which is already 7MB more than the limit and thus causing the Fatal Exception.
So, I see a few things to check/do:
That you are not retrieving unnecessary data, or in other words, retrieve only what you need.
If you indeed need all that data, then
Either increase the memory_limit value under your php.ini file
Con: If your data keeps growing, you may need to keep updating this value for the only one script and exposing your self to memory leaks or running out of memory.
Or I would recommend that you implement some sort of pagination (which will allow you to keep memory limits in check) and make your application more scalable.
ini_set('memory_limit', '-1');