I'm trying to add /usr/local/texlive/2012/bin/x86_64-linux
to the PATH
environment for my Apache user (www-data
) after installing TeX Live 2012 manually.
I edited my /etc/environment
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/texlive/2012/bin/x86_64-linux"
to include this path within my system-wide PATH
environment variable for all users.
However, if I execute sudo -u www-data printenv PATH
I'm only getting:
# sudo -u www-data printenv PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
I can't understand the source of this issue and appreciate any help.
Best Answer
I had a similar problem where I needed a specific export for www-data to use when running PHP exec command and managed to cobble together this solution:
Edit
/etc/apache2/envvars
:Add your export to the end of the file and save it.
Restart Apache:
Now if you execute the following PHP
You should see your environmental path as set in the file. It seems that apache spawns commands under www-data using the contents of that config file only and not from and of the bash.bashrc etc type files? I Can't say for certain because I'm new to Linux.
Not sure if this is exactly what you are trying to achieve but hope it helps.