Clarify instructions for .profile or .bash_profile
As per PR #56, phpenv may not be sourced by a graphical login if it is only sourced in .bash_profile; however, the instructions in README.md specifically point to .bash_profile. This may cause some unexpected behavior for some users during installation and thus needs to be amended with a more robust instruction.
https://askubuntu.com/questions/121073/why-bash-profile-is-not-getting-sourced-when-opening-a-terminal/121075#121075
Not acceptable solutions:
- source phpenv from
.bashrc(bash-specific, triggers on each subshell) - force use of
.bash_profile(bash-specific) - tell users to source
.bash_profileor.bashrcor.profilefrom one or the other (bash-specific; invasive of user preferences) - use complex logic to determine if we sourced bash_profile (bash-specific, brittle, interferes with shell emulation)
Needs testing to determine if this is an issue. Specifically:
- sshd login: working as expected
- terminal login: working as expected
- GUI login: working as expected
Hello, thanks so much for this project! Last night I was thinking surely someone has been inspired by rbenv enough to make a phpenv, so very happy to find this.
I made some notes for myself while getting this running on Fedora (29), and I wondered about this same issue. My many years on Ubuntu forced me to automatically use ~/.bashrc instead of ~/.bash_profile which works great, but I'll test if using ~/.bash_profile works too (on both Ubuntu and Fedora). It sounds like it should from your write up here.
If there are any other distros you'd like to test this on, just let us know here.
Thanks again!
Apologies, after re-reading your notes and linked post, I see you're shooting for ~/.profile instead of ~/.bash_profile
As a user, on Linux, I'm already logged in (to GUI) when I install phpenv so I just need it in the path ASAP. By habit, I typically add new paths to ~/.bashrc then launching a new tab in gnome terminal (or konsole) will find it. Adding the path to ~/.profile instead works as suggested, but if you're already logged in you'll need to source ~/.profile manually. eg.
source ~/.profile
Will test if logging out/in loads ~/.profile automatically as suggested, but from your notes looks like it should.
After (removing references in ~/.bashrc), re-loading shell and re-trying the instructions in the README, each step works perfectly. Key was step 4 (exec $SHELL -l).
Will soon confirm after logout/login that this works as suggested.
In our case (Arch linux, manjaro) the initialization via the file ~/.bash_profile did not work either. We had to move the commands to ~/.bashrc.