I've been on this for a good few hours and I'm not getting anywhere.
I can't add /usr/local/bin
to the apache users PATH
variable. The user doesn't have a .profile
, I can't su
to the user, I can't export to the PATH
from php using exec
and adding
SetEnv PATH /usr/local/bin
To either the http.conf
or the .htaccess
file doesn't make a difference. I can't find the envvars
file to change that but I suspect there's some other problem.
I have restarted apache, and indeed my server.
Any help please?
最终遵循 Alfe 在他的回答中建议的内容,除了我添加到/etc/sysconfig/httpd
的/etc/init.d/httpd
文件(可以在更新时轻松覆盖)之外:
export PATH=${PATH:+$PATH:}/usr/local/bin
Have a look at the /etc/passwd
to see which login shell the apache user has (on EC2 Ubuntu instances it should be /bin/sh
which is a link to /bin/dash
). Then have a look at the man page of that shell and find out which configuration files are read upon login. (For /bin/dash
that would be .login
in the user's home directory.) In those you should be able to extend your $PATH
as you like.
EDIT:
Since you seem to have no login shell for that user: Have a look at the /etc/init.d/*
scripts which start the system services. Apache will be one of them. They are started as root
and may change the current user (eg to the apache user). In there you might be able to adjust the PATH as you like it.
Patching those scripts, however, is not considered typical configuration. Updates might overwrite what ever you patch there.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.