Why are system env variables needed?

My installation uses phpfpm so I got the setup warning

PHP does not seem to be setup properly to query system environment variables. The test with getenv(“PATH”) only returns an empty response.

There is a decent documentation how to fix this but I cannot find an explanation why NextCloud needs this variables. For what tasks are they used? What will not work if I don’t configure them?

1 Like

Nice question.

Environement variables are accessed in the PHP code via getenv(). If you grep on “getenv”, you will see how environement variables are used :

  • To correctly use an Oracle database (ORACLE_XXX variables)
  • To know where your temporary folder (not necessarily /tmp/)
  • To discover and use an HTTPProxy
  • On windows systems, to get the user’s profile folder
  • If you have multiple versions of PHP, you may want to change your PATH to use /usr/bin/php instead of /usr/local/bin/php (for ex.) or vice versa
  • To use a specific shell

Among other things.