Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am learning about web hosts and how to create a large website with a lot of content on it, something like a learning platform and I am stuck!

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

Please help, I don't understand!

share|improve this question

2 Answers 2

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.

share|improve this answer
    
I see. So RAM of a server is in fact the PHP Memory? –  Sally Mar 22 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. –  ultrasawblade Mar 22 at 16:04
    
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 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 at 17:03

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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