Using OPcache in Docker


; # 0 means it will check on every request
; # 0 is irrelevant if opcache.validate_timestamps=0 which is desirable in production

; # how often to check script timestamps for updates, in seconds. 
; # 0 will result in OPcache checking for updates on every request.

; # The maximum number of keys (and therefore scripts) in the OPcache hash table

; # The size of the shared memory storage used by OPcache, in megabytes.

; # The maximum percentage of wasted memory that is allowed before a restart is scheduled.

; # The amount of memory used to store interned strings, in megabytes. 

; # If enabled, a fast shutdown sequence is used that doesn't free each allocated block, but relies on the Zend Engine memory manager to deallocate the entire set of request variables en masse.
; # Removed in PHP 7.2.0

The most important setting for development is the opcache.validate_timestamps=1 which allows us to make changes to our code. If you’re using a Docker volume, it means that OPcache will respect file timestamps and your changes will reflect immediately. In a production environment that’s not ideal, and that’s where our dynamic configuration will come into play shortly.1