Giter VIP home page Giter VIP logo

Comments (17)

wilmoore avatar wilmoore commented on June 13, 2024
  1. What is the output of command -v php-version?
  2. What is the output of echo $(find $(brew --cellar) -maxdepth 1 -type d | grep -E 'php[0-9]+$')

from php-version.

ngocphamm avatar ngocphamm commented on June 13, 2024

Here you go.

 ~ command -v php-version
php-version
 ~ echo $(find $(brew --cellar) -maxdepth 1 -type d | grep -E 'php[0-9]+$')
/usr/local/Cellar/php54 /usr/local/Cellar/php55

from php-version.

wilmoore avatar wilmoore commented on June 13, 2024

Please excuse the delay.

Please try running the master branch and paste the output of the "bug-report" script. Instructions are listed here:
https://github.com/wilmoore/php-version/wiki/Troubleshooting

from php-version.

ngocphamm avatar ngocphamm commented on June 13, 2024

Hi,

Below is the output of the "bug-report".

## System

  Darwin Ngoc-rMBP.local 12.5.0 Darwin Kernel Version 12.5.0: Sun Sep 29 13:33:47 PDT 2013; root:xnu-2050.48.12~1/RELEASE_X86_64 x86_64

## Script

  VERSION: php-version
  TYPE:    php-version is a shell function

## Environment

  SHELL:        /usr/local/bin/zsh
  PATH:         /Users/ngocpham/.rbenv/shims:/usr/local/bin:/usr/local/sbin:/Users/ngocpham/.gem/ruby/1.8/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/texbin:/usr/bin:/bin:/usr/sbin:/sbin
  PHPS:
  PHP_VERSIONS:

## Homebrew

  VERSION: 0.9.5
  PATH:    /usr/local/bin/brew
  PHPS:    /usr/local/Cellar/php54
/usr/local/Cellar/php55

## PHP

  VERSION: 5.4.20

from php-version.

wilmoore avatar wilmoore commented on June 13, 2024

I've recently realized that you've got to unlink the brewed formulas; perhaps that will help in this case:

brew unlink php54
brew unlink php55

from php-version.

ngocphamm avatar ngocphamm commented on June 13, 2024

php55 hasn't been linked yet because php54 is in-use. Just unlink php54 but nothing changes.

 ~  php-version
 ~  brew unlink php54
Unlinking /usr/local/Cellar/php54/5.4.20... 576 links removed
 ~  php-version

EDITED: It works with the master code, I think.

from php-version.

ngocphamm avatar ngocphamm commented on June 13, 2024

Not quite sure if it's actually works. Installed version from homebrew still shows nothing.

Do the steps noted in here and trigger php-version, I get:

 5.4.20
5.5.4

Yes, there's a space before 5.4.20.

This seems to work regardless I have linked or unlinked the php54 brew. I can now use php-version 5 to switch to php55, or php-version 5.4 to switch to php54. php -v shows that it has been switched.

However, the php-version command solely still doesn't show the current "active" version.

from php-version.

wilmoore avatar wilmoore commented on June 13, 2024

What I've noticed is that the switching will work regardless of linking or unlinking; however, the "current" version detection gets confused if you have a linked PHP. This is because homebrew-php links the php binary to the $HOMEBRW_PREFIX/bin directory which effectively makes it the first php found even if you haven't actually told php-version that you want to switch to a particular version. So, it's better to always unlink even if it seems like it is working without unlinking.

So, I would try to unlink, then start a new shell, type php-version and see if it shows a * next to any version (it should if you've added php-version 5 to your shell profile). BTW, there should always be two spaces before the version when you type php-version. The first spot is reserved for the current version * and the second space is always blank, then there is the version.

Should look something like this:

* 5.4.20
  5.5.4

I'm going to install a second version of php to see if I can replicate what you are seeing. In the meantime, let me know if unlinking helps.

from php-version.

ngocphamm avatar ngocphamm commented on June 13, 2024

What I said above is when I both tried to unlink the php54 and relink it. In both cases, triggering php-version (the temporary from master) always shows the output I posted.

To be more clear about this, I will tell you my steps.

  • Clone git to get latest changes from master into /tmp
  • brew unlink php54
  • Open new iTerm tab
  • php -v report system version, which is 5.3.x
  • source php-version/php-version.sh
  • php-version 5
  • php -v shows 5.5.4, so the latest script works on switching PHP version
  • php-version still show 2 versions without any * indicating current active version

Am I getting it wrong or what?

Thank you for your support.

from php-version.

wilmoore avatar wilmoore commented on June 13, 2024

@ngocphamm: thanks for the info...yes, I see what may be going wrong. Since I have never had more than one homebrew php version installed at once (I generally compile on my own), I didn't notice this issue.

You are definitely seeing a bug. I'm heading to the gym now but tonight I will be able to check into and correct this issue.

Thanks for hanging in there...this should be corrected soon.

from php-version.

ngocphamm avatar ngocphamm commented on June 13, 2024

@wilmoore Thanks for your confirmation. I just thought that it would be my wrong usage of it. Have a good day!

from php-version.

wilmoore avatar wilmoore commented on June 13, 2024

@ngocphamm, no problem.

This is resolved by de8331d. To verify, please try against the latest in mater.

from php-version.

ngocphamm avatar ngocphamm commented on June 13, 2024

It's okay now. I can switch and see my current "active" version. Thank you very much for it. Waiting for a release and a pull request on homebrew for this update.

from php-version.

wilmoore avatar wilmoore commented on June 13, 2024

Excellent. I'll close this since all you need now is this to be merged: josegonzalez/homebrew-php/pull/775

from php-version.

wilmoore avatar wilmoore commented on June 13, 2024

BTW, it doesn't actually have to be merged for you to install it. You can install version 0.10.3 with a direct link to the commit:

% brew remove php-version
% brew install https://raw.github.com/wilmoore/homebrew-php/1fe5bdf389e8ad19fb816d3d093c26faa834203c/Formula/php-version.rb

from php-version.

ngocphamm avatar ngocphamm commented on June 13, 2024

Cool! Thanks a lot!

from php-version.

wilmoore avatar wilmoore commented on June 13, 2024

Anytime 👍

from php-version.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.