7

I've installed OPCache GUI from GitHub and installed in my Mac. But when I run the page, it shows

The Zend OPcache extension is installed but not turned on

I've enabled the OPCache in my php.ini file with these

opcache.enable=1
opcache.enable_cli=1
zend_extension=opcache.so
opcache.memory_consumption=128
opcache.max_accelerated_files=2500
opcache.interned_strings_buffer=8
opcache.revalidate_freq=60
opcache.fast_shutdown=1
zend_extension=/path/to/opcache.so/file

Please help!

owen
  • 115
  • 5
  • 12
  • did you restart your server after enabling it? Are you running plain apache or using MAMP? Can you print your phpinfo(); – Dimi Mar 10 '17 at 17:18
  • Yes. I did restart my server. My Mac is running MAMP. Yes, I can print my phpinfo(), which portion of the phpinfo() do I have to display? – owen Mar 10 '17 at 17:29
  • See if you can find opcache.enable in php info. Also make sure that you modified the right php.ini. MAMP has a bunch of them stored for every version of php ex: `/Applications/MAMP/bin/php/php5.5.3/conf/php.ini` – Dimi Mar 10 '17 at 17:34
  • Oops. opcache.enable is "Off" in phpinfo(). But it's strange, I've installed php 7.1. But in the `/Applicaations/MAMP/bin/php/` folder, I cannot find php 7.1, instead there are 5.3, 5.4, 5.6, 7. I've tried edited the 7. But still doesn't work. Can't find 5.5.3 btw. – owen Mar 10 '17 at 17:41
  • find out which php.ini your server is using in phpinfo if you can. – Dimi Mar 10 '17 at 17:46
  • I found out which php.ini the server is using. However, I am only able to make changes to `opcache.enable_cli`. not the rest including `opcache.enable`. – owen Mar 10 '17 at 17:58
  • Anyway, thanks for your comments. I'll try it out next time. – owen Mar 11 '17 at 07:31

1 Answers1

2

I found that no matter what you set in php.ini the cache is always shown as disabled. The only way that worked, was to activate OPcache directly in the MAMP GUI.

Where you find these settings depends on the MAMP variant (standard or pro):

MAMP PRO

Language → PHP Settings → Cache module to speed up PHP execution → OPcache

enter image description here

MAMP

Settings → General → Cache → OPcache

enter image description here

insertusernamehere
  • 23,204
  • 9
  • 87
  • 126
  • 1
    how bout non-pro MAMP? – Alan Yong Feb 10 '21 at 10:58
  • 1
    @AlanYong MAMP > Preferences > General > PHP-Cache > OPCache – FTRNX Mar 24 '21 at 14:03
  • 2
    I cannot activate OPcache in the MAMP GUI. It can be selected, but it does not save that selection. It is ALWAYS going back to "off" in the GUI. And PHPAdmin shows it is off. I'm using MAMP 6.4 and php 7.4.16 and trying to edit the file at `MAMP > bin > php > php7.4.16 > conf > php.ini` lines 1738 and thereabouts. What am I missing? – Rillieux Jul 19 '21 at 06:42
  • @Rillieux Found a workaround https://stackoverflow.com/questions/74769696/mamp-pro-on-macos-cant-turn-on-opcache/74769697#74769697 – Steve Moretz Dec 12 '22 at 10:37