- Open php.ini (by default it should be located here: C:\xampp\php\php.ini).
- Add this line at the end of the file:
1zend_extension = "C:\xampp\php\ext\php_opcache.dll"
You will need to adjust the path if you installed XAMPP in non default location.
- Restart Apache server.
- To enable the OPcache, change to the following lines — easy enough!
Enable the OPcacheTo enable the OPcache, change to the following lines — easy enough!1;opcache.enable=0
Note: you have to uncomment this line as well as change the “0″ to “1″.
Modify the Amount of RAM the OPcache Will UseWith OPcache, there is a trade-off between speed and the amount of RAM used. The more RAM you are willing to dedicate to storing opcode, the more opcode that can be stored. There is a diminishing return at some point, because some code will execute rarely, or your code base might not be that big. It is worth playing with this setting to see where you get the best performance-versus-RAM trade-off. This setting is in megabytes.1;opcache.memory_consumption=64
Boost the Number of Scripts that Can Be Cached
OPcache has a strange setting that requires you to not only adjust the amount of RAM, but also define the number of scripts that can be cached. You have the option of tuning this parameter for your own application too, especially if you find that your hit rate is not close to 100 percent.1;opcache.max_accelerated_files=2000
Change the Revalidate FrequencyTo make sure that the OPcache notices when you change your PHP code, you can set the revalidate frequency. Basically, this will tell the cache how often to check the timestamp on the files. This is measured in seconds.1;opcache_revalidate_freq = 2
1opcache_revalidate_freq = 240