How to rid Nextcloud from OPcache interned_strings_buffer issues

During a routine update of Nextcloud you might see this warning:

  • The PHP OPcache module is not properly configured. The OPcache interned strings buffer is nearly full. To assure that repeating strings can be effectively cached, it is recommended to apply “opcache.interned_strings_buffer” to your PHP configuration with a value higher than “16”.. For more details see the documentation ↗.

Whilst following the documentation you get this additional advice:

https://docs.nextcloud.com/server/31/admin_manual/installation/server_tuning.html#enable-php-opcache

However, that entire section is about “Enable PHP OPcache” and nothing about “interned_string_buffer”. The one piece of advice is how to install opcache-gui and so we thought about going down this journey but quickly gave up due to unwillingness to research how to just “add” a random Github API to a working installation. So here starts the googling. With some luck, the first response is good:

“how can I install my own application into Nextcloud opcache-gui”

https://help.nextcloud.com/t/php-opcache-wont-budge-and-how-to-insert-the-opcache-gui/216167/10

Establish which PHP version by looking at the Administration / System menu and scrolling down.

Next, use this script to determine all opcache settings. If you’re overwhelmed with the output change the last word from opcache to opcache.inter  .

pv=8.3
env PHP_INI_SCAN_DIR=/etc/php/$pv/fpm/conf.d/ LC_MESSAGES=C /usr/sbin/php-fpm$pv -c /etc/php/$pv/fpm/php.ini -d "error_reporting='~E_ALL'" -i | grep -E '^[^A-Z].*=>.*=>' | sort | php$pv -r ' 
$lines = file("php://stdin", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); 
foreach ($lines as $line) { 
list($directive, $local, $master) = array_map("trim", explode("=>", $line)); 
$value = $local === "On" ? 1 : ($local === "Off" ? 0 : ($local === "no value" ? "" : $local)); 
echo "$directive=$value\n"; 
} ' | grep opcache

In my case I had this:

opcache.interned_strings_buffer=16

I notice that article the forum post talks about CLI, only FPM was applicable. I also noticed I had already upped this from 8 after installation. So I made it 24 and left a comment.

mc -e /etc/php/8.3/fpm/php.ini

 

Share this article

Leave a Reply

Your email address will not be published. Required fields are marked *