Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have several versions of PHP on my Mac. Problem is, whenever I try to install new libraries, I'm not sure which version I'm installing them to. I'm using the command line on Mac OSX, and I read somewhere that you can change which PHP version you're installing libs to, but I can't figure out how to do it. How do I tell which PHP version I'm dealing with on command line, and install libraries/modules only to that version?

share|improve this question

migrated from Dec 5 '12 at 1:42

This question came from our site for professional and enthusiast programmers.

php -v will tell you, and which php will tell you where the binary is. – Marc B Dec 4 '12 at 21:32
@MarcB It looks like which php is pointing to the wrong version. How do I change this? – link rot Dec 4 '12 at 21:51
which just scans through $PATH until it finds a match. if what it returns is the wrong version, then you'll have to fiddle with the path until the correct version's directory comes earlier in $PATH, or remove the bad versions until you get back the one you want. – Marc B Dec 4 '12 at 21:53
@MarcB so which php doesn't affect where the packages are being installed? How do I install a package to the location of the right version of PHP? – link rot Dec 4 '12 at 22:44

You must log in to answer this question.

Browse other questions tagged .