Activate Opcache in drupal 8.9.x Installation with PHP 7.3.x

14 Aug 2019 webmaster

Sometimes when you instaling the Drupal 8.x.x. you take the warining about the activation of Opcache related with your PHP version. In my case we are the PHP 7.3.1 version and the above screen appears:

.opcache not activated

The better way to find a solution is follow these steps:

  1. Search extension_dir in "phpinfo()" page, I got a path /usr/lib/php/extensions/no-debug-non-zts-20160303 
  2. Then  execute ls -lh /usr/lib/php/extensions/no-debug-non-zts-20160303, I found "opcache.so" , I guess it's installed when upgraded  my SO.
  3. I my PHP installation I'd created a "/etc/php.ini" (by copy "/etc/php.ini.default"), to modify all configuration post updated.
  4. Insert the followin code in ypur php opcache section:
[opcache]
zend_extension = opcache.so
opcache.enable = 1

EDIT / CONCLUSION

Since "opcache extension" is installed on Mac OS 10.16.x Catalina by default, the solution of enabling opcahe is: Create "/etc/php.ini" if you don't have one, by simply copy the default configuration: sudo cp /etc/php.ini.default /etc/php.ini Add zend_extension = opcache.so to /etc/php.ini and set "opcache" enable: php.ini opcache section looks like:

[opcache]
zend_extension = opcache.so
opcache.enable = 1

Redirect to Facebook Page