No environment variables are available via PHP-fpm+nginx No environment variables are available via PHP-fpm+nginx nginx nginx

No environment variables are available via PHP-fpm+nginx


I came across this problem when upgrading my OwnCloud installation to version 8.1.

They describe a fix in their documentation

Summary is: Locate your www.conf file in your php5-fpm config folder (for Ubuntu this is /etc/php5/fpm/pool.d/www.conf) and uncomment the needed env[PATH] line.

Optionally update the content of the variable with the output of php -r "echo getenv('PATH');"


By default, PHP-FPM clears the environment variables (from the www.conf):

; Clear environment in FPM workers; Prevents arbitrary environment variables from reaching FPM worker processes; by clearing the environment in workers before env vars specified in this; pool configuration are added.; Setting to "no" will make all environment variables available to PHP code; via getenv(), $_ENV and $_SERVER.; Default Value: yes;clear_env = no

You can uncomment the last line to set clear_env to no, but if you prefer, you can set only the environment variables needed:

env[PATH] = $PATH


You could specify it via an include path: http://www.php.net/manual/en/ini.core.php#ini.include-path

You can specify it your php.ini (though you may want a specific path instead of including everything)

include_path=".:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/fo‌​ta/Development/adt-bundle-linux-x86_64-20130917/sdk/platform-tools "