freenas / iocage-plugin-nextcloud

Artifact file(s) for nextcloud iocage plugin
18 stars 34 forks source link

Empty php-fpm PATH environment variable in Nextcloud plugin #19

Closed ossama-othman closed 4 years ago

ossama-othman commented 4 years ago

The Nextcloud Security & setup warnings output in the Settings->Overview page gives the following warning:

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.

Applying the following patch to /usr/local/etc/php-fpm.d/nextcloud.conf fixes the warning for me, but I'm not sure if it's the best approach:

--- nextcloud.conf.orig 2020-01-16 22:04:16.597847820 -0800
+++ nextcloud.conf      2020-01-16 22:17:46.925778249 -0800
@@ -10,3 +10,8 @@
 pm.min_spare_servers = 1
 pm.max_spare_servers = 3
 php_admin_value[session.save_path] = "/usr/local/www/nextcloud-sessions-tmp"
+env[HOSTNAME] = $HOSTNAME
+env[PATH] = /usr/local/bin:/usr/bin:/bin
+env[TMP] = /tmp
+env[TMPDIR] = /tmp
+env[TEMP] = /tmp

These environment variables were copied from /usr/local/etc/php-fpm.d/www.conf in the same jail.

miwi-fbsd commented 4 years ago

Thanks for the report. I will add this to the next update.

ossama-othman commented 4 years ago

Great! Thanks!

ossama-othman commented 4 years ago

FYI, I revised PR #21 to pull the environment variables from /usr/local/etc/php-fpm.d/www.conf and append them to /usr/local/etc/php-fpm.d/nextcloud.conf instead of doing a manual copy-n-paste.