Does PHP read required scripts every time while processing new requests ?
Can you explain what disk IO operations are performed by PHP for processing single request
Does something change if PHP is an Apache module or PHP-fpm
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.
Yes.
Imagine it this way:
script_a.php
script_b.php
At run-time, script_b.php will actually contain:
So, it reads the script (or scripts) every time a new request is handled. This is why servers with medium to high load use opcode caches like APC or eAccelerator.
What these do is cache the whole script (with requires/includes processed) in memory so it doesn’t have to be processed to bytecode the next request but can just be executed. This can translate to a substantial performance increase because there is no disk I/O and the Zend engine doesn’t have to translate the script to bytecode again.
EDIT:
No, at least not in the way PHP handles includes/requires.
Hope this helps.