How to Enable OPcache in PHP: Quick Guide

In PHP, there are several ways to enable OPcache.

  1. Set opcache.enable=1 in the php.ini file.
  2. Enable OPcache using “php -d opcache.enable=1” in the command line.
  3. Enable OPcache in PHP code using ini_set(‘opcache.enable’, ‘1’).

These methods can be implemented in various environments to enable OPcache, such as on web servers (e.g. Apache, Nginx) or in the command line. Make sure to restart the PHP service after modifying the configuration to apply the changes.

bannerAds