PHP memory_limit setting applies to the maximum memory limit which is used by a single request/script/process. It helps prevent poorly written scripts from consuming all available memory on a server. For example, if 3 PHP scripts are simultaneously using 100 MB of memory each, that would total to 300MB of memory usage, and a PHP limit of 128MB wouldn’t be hit.
The RAM memory is responsible for storing and making all the data needed to run a process or script available. Basically the system’s RAM itself is what will allocate memory to these processes or scripts as well as leaving some reserved memory to ensure proper function of other programs/services in a system.