Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify instructions for .profile or .bash_profile #88

Open
madumlao opened this issue Oct 5, 2018 · 4 comments
Open

Clarify instructions for .profile or .bash_profile #88

madumlao opened this issue Oct 5, 2018 · 4 comments

Comments

@madumlao
Copy link
Member

madumlao commented Oct 5, 2018

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_profile or .bashrc or .profile from 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
@fullstackadept
Copy link

fullstackadept commented Sep 25, 2019

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!

@fullstackadept
Copy link

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.

@fullstackadept
Copy link

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.

@sfritzsche
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants