If I go to this file with APC enabled, what happens? Does it turn out to be cached or still need to be read from disk?
If you have .html files that need to be parsed as PHP, then yes - it will be cached. Sorting.
In particular, PHP will generate an option for the document, which ultimately becomes a very short and boring program with one very large string constant in it. This will save to memory. HOWEVER, if that is all you need, it will be much better for you to use something like mod_mem_cache (not related to memcached!) Instead, since it is actually designed to cache static content.
In another scenario, I have a .php file. What happens to content outside of PHP tags? Is it stored in memory? Or does it need to be read from disk every time?
As I mentioned earlier, content outside of PHP tags is still considered part of the PHP program, although it is handled a little differently internally, a piece of static text surrounded by ?> ... <?php (or at the beginning or end file) is effectively processed as if it were in echo "..." . (Except for all errors associated with escaping inside this line.) For example, the following two code blocks are functionally more or less identical, except for some differences in the space:
<?php if ($condition) { echo "Hello"; } ?>
against.
<?php if ($condition) { ?> Hello <?php } ?>
source share