Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 stackoverflow.com Dec 5 '12 at 1:42

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

2  
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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.