I tried to add $PATH
for all users including the webserver user (i.e. www-data) with different methods such as editing /etc/profile
, /etc/environment
, etc. In all cases, it works in terminal, but not with shell commands within PHP.
For example echo $PATH
in terminal shows available paths including that I added; but, shell_exec('echo $PATH')
in PHP shows the original paths without the path I added:
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
How can I set the $PATH globally to be usable by the webserver user? I am using nginx on Ubuntu/Debian.
I tried to edit /etc/init.d/nginx
, I think this is the starting point for nginx, but no effect.