'How to enable PHP OPcode caching for Drupal 8?

I want to enable PHP OPcode caching for Drupal 8 installation. I have the following in Xampp php.ini. However, I still get opcode not enabled. What am I doing wrong??

opcache.enable=1

engine = On
zend_extension=php_opcache.dll


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


Solution 1:[1]

Hello Universe see if this helps :-

  • Try to use zend_extension=opcache instead of zend_extension=php_opcache.dll as the former has been deprecated in PHP major version. Check your php.ini file for more details.
  • Check if zend.assertions! are enabled.
  • I would recommend to go through Opcache issue solved! , which is working fine for most of the cases.
  • Restart your Apache.

Solution 2:[2]

Here is nice post about OPCache: How to use PHP OPCache?

And here is for localhost with XAMPP: https://www.drupal.org/node/2623566

Solution 3:[3]

First of all check your PHP version. Before and after PHP 5.5 things are little bit different. You may refer for difference here http://php.net/manual/en/opcache.installation.php

Also if you are using zend extension then full path of dll is required in below

zend_extension=/your/path/tod/dll/php_opcache.dll

Also make sure to use correct one in terms of threaded or non threaded version.

Solution 4:[4]

Open php.ini file. There You have to uncomment this line of code: zend_extension=opcache.so . After that restart lampp/xampp. It works for me.

Solution 5:[5]

change your php.ini config:

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

Solution 6:[6]

[opcache] zend_extension=php_opcache.dll 
;Determines if Zend OPCache in enabled 
opcache.enable=1 
opcache.memory_consumption=128 
opcache.interned_strings_buffer=8 
opcache.max_accelerated_files=4000 
opcache.revalidate_freq=60 
opcache.fast_shutdown=1

Paste this link in php.ini

Solution 7:[7]

For Mac Users Go in /Application/XAMPP/etc/php.ini line no.

Change this

;zend_extension=opcache.so

to (remove ;)

zend_extension=opcache.so

Save the file php.ini and restart the server.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 SayanTan Das
Solution 2 Community
Solution 3 Ankur Kumar Singh
Solution 4 alyn
Solution 5 Ibrahim Haouari
Solution 6 Vignesh balaji
Solution 7 Anup