Search code examples
phpopcache

Will php reload file content from filesystem when opcache is enable and use 'require' keyword?


My application use require to load app routes, like this

require __DIR__ . '/Order.php';

And I have open opcache extension, configuration is

enable_cli=1
memory_consumption=128
interned_strings_buffer=8
max_accelerated_files=4000
revalidate_freq=60
fast_shutdown=1
opcache.save_comments=0

I want to know if php reload __DIR__ . '/Order.php' from filesystem every request, even if opcache is enable.


Solution

  • Yes, if you want to avoid it, use require_once