Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix "Nextcloud is not allowed to use the OPcache API" warning #31415

Merged
merged 1 commit into from
Mar 3, 2022
Merged

Fix "Nextcloud is not allowed to use the OPcache API" warning #31415

merged 1 commit into from
Mar 3, 2022

Conversation

knox
Copy link
Contributor

@knox knox commented Mar 2, 2022

This aims to fix "Nextcloud is not allowed to use the OPcache API" warning being displayed even though OPcache is configured and running fine.

With the latest update to 23 the above warning appeared but there were no warnings or any issues before the update.

So i dug into this and found the string comparison to be causing the warning: in my setup opcache.restrict_api has a trailing slash whereas OC::$SERVEROOT has not. 🙈

To be honest i wasn't sure wether to add a slash to the server root for comparison or to remove the trailing slash and in the end i decided for the latter. Also please note that i'm not an every day PHP developer at all so don't mind if this attempt of solving the issue is not the right way to fix it at all. I'm just trying to follow the idea of submitting patches instead of just filing bugs and it was quite interesting to read through all of this. 😉

Why is there a trailing slash in my opcache.restrict_api and why dont i just remove it? I'm running a self-hosted Nextcloud instance on a server that is otherwise managed using Froxlor Server Management Panel. With this management panel the opcache.restrict_api gets somewhat dynamically configured per virtual host using a placeholder {DOCUMENT_ROOT} wich in turn has this trailing slash.

Signed-off-by: Mickey Knox <mickey@netfreaks.org>
@knox knox changed the title Fix permittedPath comparison Fix "Nextcloud is not allowed to use the OPcache API" warning Mar 2, 2022
@knox knox marked this pull request as ready for review March 2, 2022 21:59
@knox
Copy link
Contributor Author

knox commented Mar 2, 2022

@MichaIng would you please have a look here? 👍

@MichaIng MichaIng self-requested a review March 3, 2022 02:47
@MichaIng MichaIng added 3. to review Waiting for reviews bug labels Mar 3, 2022
@MichaIng MichaIng added this to the Nextcloud 24 milestone Mar 3, 2022
@MichaIng
Copy link
Member

MichaIng commented Mar 3, 2022

Many thanks, looks good. Makes sense to not break only because of a trailing slash 👍.

@MichaIng
Copy link
Member

MichaIng commented Mar 3, 2022

/backport to stable23

@MichaIng MichaIng merged commit fdf4024 into nextcloud:master Mar 3, 2022
@welcome
Copy link

welcome bot commented Mar 3, 2022

Thanks for your first pull request and welcome to the community! Feel free to keep them coming! If you are looking for issues to tackle then have a look at this selection: https://github.com/nextcloud/server/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22

@xbluemonkx
Copy link

Hi, I just updated to 23.0.3, but I am still seeing the error message in the admin panel: "The PHP OPcache module is not properly configured" - even everything is set up properly.

@MichaIng
Copy link
Member

MichaIng commented Mar 22, 2022

This only fixes the case where one is using something like opcache.restrict_api=/var/www/nextcloud/. If your warning does not contain "Nextcloud is not allowed to use the OPcache API" while you are sure you correctly configured opcache.restrict_api (or did not configure it at all), then your issue is unrelated, or the recommendation you see is simply correct and you may follow it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants