PHP cannot read system environment variables

PHP does not seem to be setup properly to query system environment variables. The test with getenv(“PATH”) only returns an empty response. Please check the installation documentation for PHP configuration notes and the PHP configuration of your server, especially when using php-fpm.

I logged in to the Admin Settings to see why my NC search was slow. I have 2GB of RAM and 1 vCPU on a VPS and I’m the only user. I noticed this error (warning?) and it seemed more urgent than the default phone code one.

  • Ubuntu 20.04.6 LTS
  • PHP 8.1
  • Nginx 1.22.0
  • Nextcloud 25.0.7

I found a warning in /var/log/PHP8.1-fpm.log:

WARNING: [pool www] server reached pm.max_children setting (5), consider raising it

I checked my notes and found that I had raised this value back when I had PHP7.4 from 5 to 25 to fix an issue where my NC desktop client didn’t sync. I raised it in the PHP8.1 config, but it didn’t fix the warning about the system environment variables.

I can only find this error mentioned in a few spots, and there’s no clear direction in the Docs. Where do I go to fix this? Please advise.

Does the error not provide a link to the docs?

In any case:

https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/security_setup_warnings.html?highlight=getenv#the-test-with-getenv-path-only-returns-an-empty-response

Which then links to the matter you’re experiencing and how to address it for PATH/etc

https://docs.nextcloud.com/server/latest/admin_manual/installation/source_installation.html#php-fpm-tips-label

If there’s room for clarity in the docs, feel free to suggest edits by clicking in the upper right corner (on the Edit button). Or, alternatively, compose some proposed language for possible inclusion and submit it as an issue at GitHub - nextcloud/documentation: 📘 Nextcloud documentation

Hope that helps.

1 Like