Skip to main content
InterviewHubPRO
Section Overview
Q13

Question 13 of 50

Part 2: Zend Engine Internals, OPcache & Memory Architecture (11 - 24)

26%
PHP & Zend Engine (50 Qs)•Part 2: Zend Engine Internals, OPcache & Memory Architecture (11 - 24)

How does OPcache work and what are the best production configuration settings?

senior LevelMost AskedCode ExampleSystem Design

In Simple Words: PHP compiles script files into opcodes (virtual machine instructions). Without OPcache, every HTTP request recompiles all PHP files from scratch. OPcache stores compiled opcodes in shared memory, allowing PHP to execute instructions directly with zero parsing overhead.

ini
opcache.enable=1
opcache.memory_consumption=256
opcache.interned_strings_buffer=16
opcache.max_accelerated_files=20000
opcache.validate_timestamps=0 ; Never check file timestamps in production!
opcache.save_comments=1