I just installed NextCloud on my shared hosting.
On the Admin panel the following warning is shown:
PHP Opcache is not properly configured
I created a php.ini file on the Nextcloud folder, with the following content:
But the error is still showing.
Nextcloud version: 12
Apache: 2.4 (CloudLinux)
PHP version: 7.1
did you try to set php values in your .htaccess?
php_flag opcache.enable 1
php_flag opcache.enable_cli 1
php_flag opcache.interned_strings_buffer 8
php_flag opcache.max_accelerated_files 10000
php_flag opcache.memory_consumption 128
php_flag opcache.save_comments 1
php_flag opcache.revalidate_freq 1
Yes. I just tried, but the warning is still showing.
Maybe PHP OPcache is not available/ configured on your server (shared hosting!!)!?
When I use phpinfo() it shows as enabled and with the recommended settings, so it is definitely enabled
Please ask your provider!
E .g. all-inkl.com does not provide opc on shared server, only on managed server.
OPcache is indeed supported.
As I mentioned before, even phpinfo() shows it as enabled with the recommended settings.
It is also detected as enabled by applications other than NextCloud.
I’ve still not been able to solve this and get rid of the warning
I forgot to mention I use Litespeed as web server instead of Apache. Could this be some sort of compatibility issue?
I’ve just noticed there are several entries like the following one, on the Logging area of the Admin section:
Error | PHP | Zend OPcache can't be temporary enabled (it may be only disabled till the end of request) at Unknown#0
Leave php_flag opcache.enable 1 away as it is already enabled
@jamin587 Just tried that and now the warning is not showing.
Thank you very much!
I have now tried to remove the php opcache settings and the warning doesn’t show even if the recommended settings are not applied. Any idea regarding why this might be happening?
Checked that on my nextcloud. If i remove
message is shown again.
Do you use .htaccess or php.ini?
Reload/restart apache after changing values
I changed both htaccess and php.ini, just in case.
I didn’t restart to make the warning disappear (actually I’m using litespeed, not apache)
Than do it just in one place, i suggest php.ini and restart litespeed.
Opcache is enabled, than you reconfigure it with optimized values and i guess these values stay active also you remove them.
If you restart your webserver there will be default values used by Opcache. Just a theory, but removing recommended values may not trigger a reset to default values.
I’ve just solved the same issue on newly installed Nextcloud on openSUSE. Just needed to install
zypper in php7-opcache
systemctl restart php-fpm
'memcache.local' => '\\OC\\Memcache\\APCu' doesn’t work without
zypper in php7-APCu
For me none of this worked on CentOS and had to modify 10-opcache.ini directly.