Magento Random Fatal Error - php

I have a VPS apache server based in a farm.
Recently i sufferd from memory limit errors and i decided to increase the number of the memory limit by changing it in the WHM panel at PHP Configuration to 256MB. after i was presss the button "Save", i got my site (and other wordpress sites i have in my server) all over with random fatal errors and 500 internal server errors on my site: http://amadeus-trade.ru
I can log into the backoffice but, when i tried to go to System -> Configuration i get this error:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, webmaster#amadeus-trade.ru and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request
And when i try to add products i get this error:
Fatal error: Out of memory (allocated 19922944) (tried to allocate 1245184 bytes) in /home/amadeus/public_html/app/code/core/Zend/Date.php on line 2423
This error allways jumps from file to file and looks like this scheme:
Fatal error: Out of memory (allocated xxxxxxxx) (tried to allocate xxxxxxx bytes) in /home/amadeus/public_html/xxx/xxxx/xxx/xx/xx.php on line xxxx
Now, It is fresh installation. so far (until 01.11.12) the website worked great without problems.
The team in the hosting company says that this is aproblem of a code in magento but i positivly sure that the problem is on the server!
My WHM version was update by the team in 01.11.12 to v11.30
Can you assist me please how to solve this?

Looking at your error message
Fatal error: Out of memory (allocated 19922944) (tried to allocate 1245184 bytes)
in /home/amadeus/public_html/app/code/core/Zend/Date.php on line 2423
PHP is telling you it tried to allocate 1,245,184 bytes of memory, but that was over the limit allowed. It's also telling you there are currently 19,922,944 bytes allocated.
1,245,184 bytes is 1,216 kilobytes (KB), which is 1.1875 megabytes (MB).
19,922,944 bytes is 19,456 kilobytes (KB), which is about 19 megabytes (MB).
This means one of two things.
PHP thinks it's only allowed to allocate around 19 MB of memory
The operating system PHP is running on ran out of memory
Check your runtime php.ini settings to make sure your memory change stuck (use a single page calling the phpinfo function to do this). Also, make sure it's 256M, and not 256MB. The later won't be recognized by PHP, and "weird things" will happen (including a super low memory limit).
That said, my guess is it's the later. When my version of PHP goes over the limit set in the memory_limit ini, I get a slightly different error.
PHP Fatal error: Allowed memory size of 262144 bytes exhausted (tried to allocate 10493952 bytes)
PHP is telling me that it's allowed limit has been violated. Your error
Fatal error: Out of memory
Says PHP has literally used up all the memory avaiable to the server at that point in time.
Beyond that, you host's response show a lack of Magento specific knowledge — any host capable of running the system would be able to the give you the information I just did. I'd start by asking them what the maximum memory limit is for a single PHP request. I'd end by moving to a VPS host that advertising Magento capability and has a good reputation for it.

Could it be that 256M was lower than it originally was set to? As it sounds like you already know, Magento requires a minimum of (get this) 256mb of ram, and 512 is recommended, and certainly more for larger applications.
Run a phpinfo() command and see what the memory_limit property is set to. If you can, use your .htaccess to change the limit to a more reasonable level:
php_value memory_limit 512M
However, I must say that there is a good chance that your hosting provider will frown on changing this setting (if they don't allow you to do it in .htaccess).

Related

Concrete5 PHP GD running out of memory

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.

PHP Fatal error: Out of memory (allocated 524288) (tried to allocate 311296 bytes)

In my php error log for about a months ago i see an error
PHP Fatal error: Out of memory (allocated 524288) (tried to allocate 311296 bytes) public_html/index.php on line 347
It's strange because the error says that it allocated only 524288 which would be 512 KB
the error is the same as always and occurs only on this line of script and i get about 10-20 times this error per day
in index.php i have included 4-5 script and on that line (ln 347) there is which only returns some css codes and There is no infinite loop
I've read a lot of topics and changed mempry_limit to 256M and added RLimitMEM 173741824 247483648 and MaxRequestsPerChild 9000 In apache
In my tests i use a code like this
if($_SERVER['REMOTE_ADDR'] == $my_IP)
{
var_dump(memory_get_usage());
var_dump(memory_get_peak_usage());
}
in on the beginning and the end of script which results:
int(729812) int(741124) - int(915952) int(953968)
I have a vps with php 5.3.22 installed and with 1.5 GB ram where most of times 200-500 mb is free and i have something about 20,000 hits per day maybe more and server load sometimes goes to 8 for a little period of times
the website is very fast and there is nothing wrong with speed
in the root there are 3-4 php files which is accessible by public too but in error log i dont see them although they dont have that hits as index.php
in my localhost i install x-debug and win cache grind and when i profile the index.php script i see nothing wrong in there too
On this vps i've also install wordpress which gives errors too but at least the amount of memory he could allocated is more, one of the error is like this:
PHP Fatal error: Out of memory (allocated 9961472) (tried to allocate 7 bytes) in /public_html/blog/wp-includes/canonical.php on line 157
for the wordpress i'v set memory_limit 256M in htaccess
I have also install livezilla which gives errors too
PHP Fatal error: Out of memory (allocated 524288) (tried to allocate 77824 bytes) in public_html/support/_lib/functions.global.inc.php on line 520
for the livezilla i'v also set memory_limit 256M in htaccess
I should mention that in my vps i've hosted 5-6 other websites
And one time i faced with this error in phpMyAdmin that says:
PHP Fatal error: Out of memory (allocated 524288) ...
again only allocated 524288
Iv restarted apache over and over but nothing changes
Could the line number in error log be wrong due to including other scripts before that line?
Could it be the Cpu issue?
I'm struggling with this error about 2 months and i don't know what to do else
any idea?
It's very likely that your webserver is miss configured regarding memory consumption, allowed concurrent requests and available memory.
Evaluate your logs to see how many and what concurrent requests you have on such peaks. You might stress your server with ab to reproduce those situations. 1.5 GB ram for 20k hits a day just feels wrong. Check your webserver configuration how many concurrent requests are allowed and how big a fork might grow. I'm quiet certain they will easily eat up those 1.5 GB.
setting configuration for prefork in apache worked!

wordpress Fatal error: Out of memory

I have set php memory limit from whm to 256M from WHM > PHP Configuration Editor.
Even so, my wordpress website and admin is showing me an error like below.
Fatal error: Out of memory (allocated 36175872) (tried to allocate 30720 bytes) in /home/XXXX/public_html/wp-includes/class-simplepie.php on line 14272
Fatal error: Out of memory (allocated 35127296) (tried to allocate 1966080 bytes) in /home/XXXX/public_html/wp-includes/class-simplepie.php on line 5427
I also tried to add following line to the top of wp-config.php, but no luck and same error.
define('WP_MEMORY_LIMIT', '128M');
can anyone suggest me or tell me what may be the solution?
I finally think I've solved the White Screen of Death from PHP out of memory Fatal Errors.
Full details here: http://www.isthisyourhomework.com/how-to-fix-the-wordpress-white-screen-of-death/
If setting the WordPress and PHP memory limits doesn't work for you, try adding/edditing the following line in either your Apache conf files. I didn't have access to those, so I added the following line to the .htaccess file in my WP server's document root:
RLimitMEM max
Many hosts have set limits on each user on shared-use servers. The above setting will unfetter your server and banish the WSOD.
The SimplePie people reckon that this is caused by a bug in PHP. It was fixed in PHP version 5.3. Upgrading might help.
Newer versions of SimplePie use less memory but still suffer from the same PHP bug that causes lots of cached items to cause you to use loads of memory.
Did you change the memory limit in php.ini(or through WHM service configuration page)? If so, try rebooting Apache

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 87 bytes)

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');

PHP Fatal Error caused by Magento

So I'm checking my error logs and notice a bunch of these:
[20-Aug-2010 15:06:32] PHP Fatal error: Allowed memory size of 262144000 bytes exhausted (tried to allocate 16 bytes) in /home/website/public_html/lib/Zend/Db/Statement/Pdo.php on line 294
So I know that this has to do with the memory size set in php.ini, but it has been set to 250mb, which seems pretty high already for a VPS. There's quite a few of these errors, however front end performance is not affected.
Is it possible that I'm leaking memory somewhere, or is this a minor error?
Update: this is on a myriad of files:
app/code/core/Mage/Core/Model/Config.php
app/code/core/Mage/Eav/Model/Entity/Attribute/Abstract.php
lib/Zend/Db/Select.php
Mostly on models it appears?
512mb is recommended and on our sites we use it.
There might be situation (ex: reindexing) where You can have problems.

Categories