Problem with environmental variables

Admin section tells me:
> 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 :arrow_upper_right: for php configuration notes and the php configuration of your server, especially when using php-fpm.

I am running php-fpm with lighttpd, php 5.6.30. My php.ini says:

env[PATH] = /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
env[HOSTNAME] = $HOSTNAME
;env[PATH] = /usr/local/bin:/usr/bin:/bin
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp

Still, the environment variables do not show up. What do I need to do to get the variables showing in Nextcloud?

You want to check the config of the POOL and not the main php.ini file.

It should be under e.g. /etc/php/$version/php-fpm/pool.d/$poolname.conf

Cu

1 Like

I read this https://support.rackspace.com/how-to/install-nginx-and-php-fpm-running-on-unix-file-sockets/ and created a new config in pool.d/
And then # /etc/init.d/php5-fpm restart
See your new socket here # ls -l /var/run/

That solved it for me.

I have the same issue after upgrading to Nextcloud 12.0
Can you posts the steps and what you did?

I am running Nginx and php 7.0 so the location is /var/run/php/php7.0-fpm.pid

Thanks

Fixed it. When I updated Ubuntu 16.04 a new www.config was created in /etc/php/7.0/fpm/pool.d which replaced the previous with www.config.dpkg-pld.old …Something was missing and I put it back and now the admin warning is gone.

env[PATH] = /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games

thanks, need uncomment env[PATH] sentences.

Installed 18.04 and php 7.2 and had to do it once again in www.config.

I can’t believe that I had to fix it again.

I have searched all of the files for these configuration changes. it doesn’t matter what files I uncomment. the error never goes away.

im running nextcloud 17 in jail of FreeNAS. none of the documentation seems to line up for this configuration.

@johnnycloud This patch to /usr/local/etc/php-fpm.d/nextcloud.conf on my FreeNAS Nextcloud jail worked for me:

— 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

Note that you’ll need to drop the leading ‘+’ when adding the lines manually instead of through the patch command.

See issue #19 in the FreeNAS iocage-plugin-nextcloud repository for details.

HTH!

Thanks for this. It was the first thing i tried, and it worked.

thanks for sharing this, you saved my day