Answer the question
In order to leave comments, you need to log in
How to make PHP under Apache understand the user's home directory?
Used by mpm_itk, exec('whoami') gives the correct username. exec('ls ~ 2>&1') gives ls: cannot access '~': No such file or directory. That is, apparently, php running under Apache does not own the $HOME value.
Because of this, aliases do not work, for example, or git commands requiring a user config, or file operations starting with a tilde.
In console mode, everything works as it should, and php.ini is identical for both Apache and CLI.
Is there a way to fully run commands from PHP on behalf of the user? Nothing helped from what I found
UPD:I managed to solve it by adding the export HOME=/home/ss line to /etc/apache2/envvars, everything works except for aliases. Anyway, if anyone knows, please write. Since this option is working as long as Apache is used by only one user.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question