(20.0.1) Errors PhpStatistics, opcache_get_status() has been disabled for security reasons

Hello,
I’ve installed with the Plesk’s extension the last version of NextCloud (20.0.1) but now I receive these errors when I try to enter in the System tab

Internal Server Error

The server was unable to complete your request.
If this happens again, please send the technical details below to the server administrator.
More details can be found in the server log.

These are the errors reported in the logs:

Exception: 
Return value of OCA\ServerInfo\PhpStatistics::getOPcacheStatus() must be of the type array, null returned

Caused by:
Return value of OCA\ServerInfo\PhpStatistics::getOPcacheStatus() must be of the type array, null returned

Error: opcache_get_status() has been disabled for security reasons at /var/www/vhosts/mydomain/nextcloud/apps/serverinfo/lib/PhpStatistics.php#83

I’ve others NextCloud installations on the server, all of them with the 19 versions but without the above errors.
How can I fix it?
Thanks.

1 Like

Nobody had this problem?

ive just discovered the same problem after doing a fresh install today on a new website using the nextcloud plugin with plesk too

im still looking into it

found the issue with the security issue
inside plesk under the PHP settings of your domain,
you need to CLEAR IT/EMPTY the disable_functions text box and save :slight_smile:

2 Likes

Thanks!
Now the System tab is shown without errors.

Also I’ve added this instruction in the Additional Directives because I received an error for the PHP output buffering:
output_buffering = off

i got the same problem but i can’t enable this function. So the PhpStatistics.php should be fixed.

Errors/Exceptions

If opcache.restrict_api is in use and the current path is in violation of the rule, an E_WARNING will be raised; no status information will be returned.

I think that’s the reason why the check of “opcache_get_status(false) === false” isn’t working.

apps / serverinfo / lib / PhpStatistics.php (Line 82-88)

// get status information about the cache
$status = @opcache_get_status(false);

if ($status === false OR $status === NULL) {
// no array, returning back empty array to prevent any errors on JS side.
$status = ;
}

@bjoern

1 Like

:+1: That was what I was looking for.

Better than to use ‘@’ may be:

$status = (function_exists('opcache_get_status')) ? opcache_get_status(false) : false;
1 Like