How to enable PHP OPCache in localhost running XAMPP on Windows?

| |

When installing Drupal 9 in Windows OS running XAMPP, we get a warning to enable PHP OPCache .  In this post, we will see how to enable PHP OPCode Caching on localhost running XAMPP. The exact error message is reproduced below.

PHP OPcode caching

Not enable

PHP OPcode caching can improve your site’s performance considerably. It is highly recommended to have OPcache installed on your server.

Enable PHP OPCache on Windows XAMPP

If your XAMPP comes with PHP 5.5+, opcache is already included in the bundle by default. So, you just need to enable it.

  • Open php.ini (located at: C:\xampp\php\php.ini).
  • Add this line at the end of the php.ini file:
    zend_extension = “C:\xampp\php\ext\php_opcache.dll”
  • On the same php.ini file, remove the ‘;’ from the following settings:

opcache.enable=1
opcache.memory_consumption=64
opcache.max_wasted_percentage=5
opcache.use_cwd=1

  • Finally, restart Apache.

Enable OPCache in XAMPP in Mac OS X

To enable PHP OPCODE Caching for XAMPP running on Mac OS X, do the following

  • Open php.ini (located in /Applications/XAMPP/xamppfiles/etc/.
  • Find the line “zend_extension=opcache.so” in the php.ini file and uncomment the line.
  • And restart Apache.

 

 

#How to enable PHP OPCache in Windows 10 #Enable PHP OPCache in XAMPP

XAMPP – MySQL Service detected with wrong path – running multiple MySQL on same computer

Next

Leave a Reply