nextcloud / server

☁️ Nextcloud server, a safe home for all your data
https://nextcloud.com
GNU Affero General Public License v3.0
26.47k stars 3.98k forks source link

[Bug]: `occ setupchecks` - OPcache Configuration Checks should not be performed if `opcache.enable_cli` is disabled #46351

Closed adripo closed 3 weeks ago

adripo commented 1 month ago

⚠️ This issue respects the following points: ⚠️

Bug description

When running the occ setupchecks command after upgrading to v29.0.3, the following errors related to PHP OPcache configuration are encountered:

✗ PHP opcache: The PHP OPcache module is not properly configured. OPcache is not working as it should, opcache_get_status() returns false, please check configuration.
The maximum number of OPcache keys is nearly exceeded. To assure that all scripts can be kept in the cache, it is recommended to apply "opcache.max_accelerated_files" to your PHP configuration with a value higher than "10000".
The OPcache buffer is nearly full. To assure that all scripts can be hold in cache, it is recommended to apply "opcache.memory_consumption" to your PHP configuration with a value higher than "128"..

It appears that the OPcache checks are being performed even when opcache.enable_cli is disabled. Since OPcache is intentionally disabled for CLI calls by default, these checks should be skipped in this context.

see: https://github.com/nextcloud/docker/issues/2184#issuecomment-2212576523

Steps to reproduce

  1. Run v29.0.3.
  2. Run the occ setupchecks command.
  3. Observe the OPcache related errors.

Expected behavior

The occ setupchecks command should:

Skip OPcache checks if opcache.enable_cli is disabled. Only perform OPcache checks if opcache.enable_cli is enabled.

Installation method

Community Docker image

Nextcloud Server version

29

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.2

Web server

Apache (supported)

Database engine version

PostgreSQL

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

Upgraded to a MAJOR version (ex. 28 to 29)

Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

What user-backends are you using?

Configuration report

No response

List of activated Apps

No response

Nextcloud Signing status

No response

Nextcloud Logs

No response

Additional info

Link to conversation: https://github.com/nextcloud/docker/issues/2184#issuecomment-2082845207

Proposed Solution

  1. Check if opcache.enable_cli is enabled: Before running any OPcache checks, the command should first verify whether opcache.enable_cli is enabled.
  2. Skip checks if disabled: If opcache.enable_cli is disabled (which is a reasonable default and production value), the command should not perform any OPcache checks or return related errors.
  3. Perform checks if enabled: If opcache.enable_cli is enabled, the command can run the OPcache checks for debugging and development purposes.
solracsf commented 1 month ago

Agree; same on my instance, it makes no sense checking those if it is disabled on CLI.