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
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
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.
PHP does read the files upon each request. You can use an opcode cacher such as XCache that keep opcode in memory and thus doesn't require PHP to actually read the file (just checks its modified time). FPM and apache module don't influence anything
When a PHP script is executed it will be read from the harddrive. Same goes for any scripts included by the originally executed script. There are however certain caching techniques you could employ if you are worried about performance.
See here: http://php.net/manual/en/book.apc.php