When I set ini_set('memory_limit', '100M');
in an included script, does this apply to the complete request, in which this script is included?
views:
40answers:
1Update re acmatos' comment: Yes, if you call set_memory_limit
in a child include, it will apply to the whole script. An include is not a separate process of any kind, but simply another place for the PHP interpreter to look for code. To the interpreter, there is one script, no matter how many files you include.
The only exception is when you include a file using a http://
URL. That is treated like a remote request even though it points on localhost. For that, a new request is started to parse that file, a new PHP process is started, which has its own memory limit. This practice is highly unusual though.
Old answer:
I'm not sure what you mean by "complete request" in this context, but the answer is probably no. The memory limit applies to the PHP script only and memory allocated/used by it. It does not apply to any external binaries called using exec()
for example.