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?
When I set ini_set(‘memory_limit’, ‘100M’); in an included script, does this apply to the
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Update re acmatos’ comment: Yes, if you call
set_memory_limitin 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.