Skip to main content
Topic: Cannot change Cookies and Sessions settings  (Read 1338 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Cannot change Cookies and Sessions settings

I think my problem related to unread replies which are not working is related to sessions, so I tried to change settings in Cookies and Sessions, but I cannot save, I get this error: Zend OPcache API is restricted by "restrict_api" configuration directive
I tried to disable OPcache but nothing changed.
sorry for my bad english

Re: Cannot change Cookies and Sessions settings

Reply #1

Did you check the actual settings.php file to see if it changed?

I'm hoping it was changed and the above error is due to your setup restricting access to the opcache_invalidate function.   That means your changes will not show up until the cache naturally invalidates the file.

Re: Cannot change Cookies and Sessions settings

Reply #2

I didn't checked settings.php file. I switched to php 5.6, made the edits, than switched back to php 7.2. Settings were saved in this way
sorry for my bad english

Re: Cannot change Cookies and Sessions settings

Reply #3

OK .... well from reading my guess is that the check we do

Code: [Select]
if (function_exists('opcache_invalidate'))

is not sufficient and has a couple of bugs.  First  the function existing does not mean that you are using the opcache.  Second even if it exists, it does not mean we can use it.

So I'm thinking we need to change that to be

Code: [Select]
if (extension_loaded('Zend OPcache') && ini_get('opcache.enable') && stripos(BOARDDIR, ini_get('opcache.restrict_api')) !== 0)

Which checks that the extension is available, that we have enabled it and that we are not restricted from using certain functions (like opcache_invalidate).   This will prevent the error HOWEVER you will still have the cache issue as the cache is using the old file for "some time" based on the values you are running the opcode under.
Last Edit: May 03, 2018, 07:52:02 pm by Spuds