1

I've had a lot of problems with my web server recently & so upgraded the memory on advice from my hosting company, however it crashed again & they're advising that it's still an out of memory problem, despite my cPanel resource monitoring showing no CPU or Memory usage above 10% (& all well within the 100%).

They are saying I need to increase the memory allocation for my PHP scripts, which I can do, but was dubious that 1 script running out of it's allocated memory allocation could bring down the server. I thought the point of a PHP script memory limit was there to stop PHP consuming all the server memory?

Does each PHP script on the server share the same PHP memory allocation then?

7
  • It must be a bug in the code. Could you check the error log and show us which bits of the code are causing the server to crash? Commented Nov 26, 2012 at 12:03
  • And yeah, I think it's unlikely for one script to crash the whole server. Commented Nov 26, 2012 at 12:04
  • AFAIK each script can use up to the maximum specified in the php.ini so I suppose if you have 20 people running an intensive script that reaches the limit set say 50MB at once it will use 20 times that amount of memory will be used while the script is executed by 20 people. php.net/manual/en/ini.core.php#ini.memory-limit Commented Nov 26, 2012 at 12:06
  • This may interest you - PHP Memory info for debugging codelibrary.me/optimization/php-memory-info You can check if you get any spikes of memory. Just litter this through the page and check the results. Commented Nov 26, 2012 at 12:06
  • Is this a simple script, or something to the scale of an application that invloves way too many loops or calculations? Commented Nov 26, 2012 at 12:14

1 Answer 1

2

No, the memory_limit is for each script instance individually. To answer your question, a single PHP script instance running out of memory should not bring down the entire webserver.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.