I have a Drupal based web site on a relative small vserver (512MB RAM). Recently the website begins to return php out of memory messages like this:
Fatal error: Out of memory (allocated 17039360) (tried to allocate 77824 bytes) in /home/...
All php.ini memory limit parameters are set to off (-1).
Propably the website has gained of complexity, content, etc. But I cannot interpret fine that message: Does that mean that the whole request has allocated 17MB(?) right now and cannot get 7KB(?) more from the OS. Has the web server spend all memory or has the OS no more memory to allocate ?
I'm not shure if the memory overhead is coming from the web server or another service, because when I get the out-of-memoy message I can't get into the server with ssh. After a while all runs fine again.
In php.ini set the following,
Furthermore, its worth noting if you are uploading a image via the GD send libary then you are sending a image that will be uncompressed in memory. So for example if its a 3000x3000 file the actual size if using GD is:
width * height * bit-depth, e.g., 3000*3000*32 = 288000000 bits = 34 MB
It's also worth mentioning that 512mb these days for any linux build is a low amount for a LAMP, even if the site is small and only has a few visitors each day the memory usage is near its max, and depending on what your uploading can be an issue. Many VPS's disable the SWAP as the VPS owners do not want CONSTANT disc writes which slow down the other VPS's (Disks cause Lag on VM Servers with SWAP enabled).
So the changes are the file is simply to big and your running out of memory, assuming that your using a good vps provider you should be able to scale up the memory to 1gb and see if it still recalls this error.
Have you added any new modules to the site? It could be a memory leak in a script or endless loop. But they'll typically generate high CPU usage.
You should consider installing xdebug ( http://www.xdebug.org/ )you will get detailed errors about the application to figure out the problem area. This is mostly used by developers though.
Found a possible duplicate on Stackoverflow and its answer
Have you tried killing the previous apache threads?