8

I installed Drupal 8 on MAMP Pro with PHP 7. I am getting this warning in my Drupal reports page:

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

I looked in MAMP's PHP 7 ini file and I see this code which seems to be related to OPcode caching.

[OPcache]
MAMP_OPcache_MAMP
  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

So I am not sure if I need to do anything else to enable it, it seems to be enabled based on the code above. I googled around and could not find any specific documentation with regard to MAMP and PHP OPcode caching.

3
  • You're welcome, glad it helped. I posted the answer, but I'm not 100% sure if this is the right question to keep on DA. Moderators will decide I guess. Feb 23 '16 at 16:25
  • Yes, it may be it should be moved to Server Fault or another site. Feb 23 '16 at 16:34
  • While there is overlap with SuperUser or AskDifferent (not ServerFault), MAMP is a common tool for Drupal development, and the question stems from a Drupal warning during setup. I think this makes is close enough to being on topic here in my eyes.
    – mpdonadio
    Feb 23 '16 at 21:30
10

Just make sure that the OPCache is selected as caching mechanism in MAMP preferences.

  1. Click on "Preferences".
  2. Click on the "PHP" tab.
  3. Select "OPcache" under "Cache" field.

MAMP screenshot - PHP settings and OPcache

0
9

The UI is slightly different for Mamp Pro. Some may find this screenshot helpful.

Mamp Pro UI differences for Opcache

More recent versions of MAMP Pro have a different layout for the UI.

enter image description here

1
  • Since updating MAMP (free version) It no longer let's me apply OPcache as the PHP-Cache option. I can select and click OK, but if I edit MAMP preferences again, it' always set to off. I confirmed via CLI which php.ini was being used and ensured the php.ini was set to enable OPCache but still MAMP won't allow me to turn it on; and the Drupal installation Window warns me that it's off. Has anyone else had this issue? Jun 28 at 2:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.