5

I am learning about web hosts and how to create a large website (eg. a learning platform).

Is PHP Memory Limit some "RAM Memory" of a Server (like the RAM memory of my computer?) or just some kind of space available on a hard drive?

3

Any time a client makes a request to your web server, and PHP handles it, it spawns off a PHP process.

The job of this PHP process is to obviously generate some HTML to throw back at the client - the PHP process provides a runtime to a PHP script that should be doing that.

The memory limit is the maximum amount of memory this process can use. If you exceed it, the process fails and Apache reports an HTTP 500 error.

Basically, if there is an error in your PHP script, like an infinite loop that keeps asking for more and more RAM, it's one bulwark that can prevent it from taking the entire server down.

4
  • I see. So RAM of a server is in fact the PHP Memory? – Sally Mar 22 '14 at 15:59
  • No, it's the limit of how much a PHP process can ask the system for, before it's killed. I hope you have much, much more RAM than your PHP memory limit. :) - Well ... I mean the setting has to do with RAM, yes, if that's what you mean. – LawrenceC Mar 22 '14 at 16:04
  • 1
    Okay, last check if I have understood correctly: If the server has 512MB RAM and I have a PHP Memory Limit of 120 MB, it means that the PHP scripts/processes can take maximum 120MB of the existing 512MB RAM of the server. Do I assume correct?:) – Sally Mar 22 '14 at 16:17
  • It means that every PHP process can take up to 120 MB memory. So, if there are 4 concurrent requests, they can use up to 480 MB memory. – Tero Kilkanen Mar 22 '14 at 17:03
0

Find your php.ini files and increase the define memory limits to meets your needs. The php intentional limits the amount of RAM php can use so a hacker can't try to use up all your memory and cause the server to crash/lockup/do other bad things.

Note: In order to maintain performance do not enter values larger than around 60% of your real memory size.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.