server icon indicating copy to clipboard operation
server copied to clipboard

[Bug]: Warning: Zend OPcache API is restricted by "restrict_api" configuration directive

Open roman-doubrava opened this issue 1 year ago • 1 comments

⚠️ This issue respects the following points: ⚠️

Bug description

Dear Nextcloud Support, we have tried to install the Nextcloud Versions 28 and 29 on PHP 8.2.22 using the installation script "https://download.nextcloud.com/server/installer/setup-nextcloud.php" and both fail with the same error before the main install dialog appears where we can input the database connection settings:

Warning: Zend OPcache API is restricted by "restrict_api" configuration directive in /www/doc/www.data-business.de/www/cloud/lib/private/Config.php on line 218
Config file has leading content, please remove everything before "<?php" in config.php
Fatal error: Uncaught Error: Typed static property OC::$server must not be accessed before initialization in /www/doc/www.data-business.de/www/cloud/index.php:98 Stack trace: #0 {main} thrown in /www/doc/www.data-business.de/www/cloud/index.php on line 98

The Nextcloud Version 27.1.11 works on PHP 8.2.22 without any issues, however when we try to upgrade to 28 after a successfull install it fails with the same error above.

Our hosting provider has a setting restrict_api for all customers and is not willing to change this: opcache.restrict_api /www/doc/local

When we comment out the line /www/cloud/lib/private/Config.php on line 218 [//opcache_invalidate($file, false);] it works.

Best regards

Steps to reproduce

  1. Install Nextcloud 28 or 29 on PHP 8.2.22 where opcache.restrict_api is set to a restricted folder
  2. Or Upgrade from Nextcloud 27 to 28

Expected behavior

Fresh install should work Upgrade for 27 to 28 should work

Installation method

Community Web installer on a VPS or web space

Nextcloud Server version

28

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.2

Web server

Apache (supported)

Database engine version

MariaDB

Is this bug present after an update or on a fresh install?

Fresh Nextcloud Server install

Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

What user-backends are you using?

  • [X] Default user-backend (database)
  • [ ] LDAP/ Active Directory
  • [ ] SSO - SAML
  • [ ] Other

Configuration report

No response

List of activated Apps

No response

Nextcloud Signing status

No response

Nextcloud Logs

No response

Additional info

No response

roman-doubrava avatar Aug 28 '24 09:08 roman-doubrava

When we comment out the line /www/cloud/lib/private/Config.php on line 218 [//opcache_invalidate($file, false);] it works.

Does putting an @ in front of it instead of commenting it out work in your environment?

We're already doing that elsewhere (around line 288 in that version of the same file you can see it). The one you're encountering was added recently. And the suppression for exactly your situation was overlooked there it looks like.

joshtrichards avatar Aug 28 '24 12:08 joshtrichards

Yes putting an @ in front works as well, thank you very much.

roman-doubrava avatar Aug 29 '24 06:08 roman-doubrava

Glad to hear it! It'll be fixed in upcoming maintenance releases.

joshtrichards avatar Aug 29 '24 12:08 joshtrichards