1

I've had a problem since version 6 enter image description here

When we set this to opcache, it won't be saved on the next restart we see it says unsaved changes want to start? if you say yes it will still load opcache but as soon as you save it, it will be off again.

That actually means it was saved but cause of a bug, Mamp Pro UI isn't able to load that to its own UI.

So how to get rid of that warning everytime we restart the system or mac itself?

Steve Moretz
  • 2,758
  • 1
  • 17
  • 31

1 Answers1

1

As I mentioned this is a bug in MAMP PRO making mamp unable to understand that opcache is actually on, it thinks it's off and when you save the changes it will literally get off. We can leave that to off, but enable opcache ourselves, that way everything will be solved.

First click on Open template so you can open php.ini for your current php version.

enter image description here

First copy the whole content of this file and get yourself a backup of it.

in the opened editor you can search for opcache and you'll find a section about it, comment it all and enable the options you want, make sure you set opcache.enable=1

[opcache]
;MAMP_OPcache_MAMPzend_extension="/Applications/MAMP/bin/php/php8.1.1/lib/php/extensions/no-debug-non-zts-20210902/opcache.so"
; Standard settings, see below for detailed explanation
;  opcache.enable=1
;  opcache.enable_cli=1
;  opcache.memory_consumption=128
;  opcache.interned_strings_buffer=8
;  opcache.max_accelerated_files=10000
;  opcache.revalidate_freq=2
;  opcache.fast_shutdown=0
  
; opcache.jit_buffer_size=100M  ; needs opcache.enable=1
; opcache.jit=1255

opcache.enable=1
opcache.memory_consumption=256
opcache.interned_strings_buffer=80
opcache.max_accelerated_files=100000
opcache.enable_cli=0
opcache.jit_buffer_size=150M    ; needs opcache.enable=1
opcache.jit=1255

Now from the second line of the above block, you can find

;MAMP_OPcache_MAMPzend_extension="/Applications/MAMP/bin/php/php8.1.1/lib/php/extensions/no-debug-non-zts-20210902/opcache.so"

That's what we need to enable opcache manually just omit ;MAMP_OPcache_MAMP and you'll get something like

zend_extension="/Applications/MAMP/bin/php/php8.1.1/lib/php/extensions/no-debug-non-zts-20210902/opcache.so"

Great, all you have to do now is to put this at the end of your editor.

enter image description here

Close the editor and save it, now turn off the opcache in the UI if it's on, and you'll still have it on, you won't get an annoying warning and saving won't turn it off anymore.

If you ever wanted to disable opcache just comment that last line that you added in the editor.

Steve Moretz
  • 2,758
  • 1
  • 17
  • 31