Search code examples
phplaravelubuntufpmopcache

If opcache is open, why does my new code work even without any php-fpm restart?


Anybody help? When I enable opcache, shouldn't I restart php-fpm it every time I update the code? I'm not restarting it, but my new code is running immediately.

Here's my opcache setup: https://ibb.co/rkvTcyk

Thank you


Solution

  • You have opcache.validate_timestamps enabled. From the docs:

    opcache.validate_timestamps boolean
    

    If enabled, OPcache will check for updated scripts every opcache.revalidate_freq seconds. When this directive is disabled, you must reset OPcache manually via opcache_reset(), opcache_invalidate() or by restarting the Web server for changes to the filesystem to take effect.

    As you have an opcache.revalidate_freq of 2 your server will check for updates to the file every 2 seconds.