Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RVM equivalent for PHP?

I can't seem to find a way to switch versions of PHP quickly. Is there something equivalent to ruby version manager for php? I need to switch between 5.3 and 5.2 on OS X.

like image 543
johmas Avatar asked Sep 01 '10 14:09

johmas


3 Answers

For PHP alternatives to RVM and rbenv, you have phpbrew, phpenv and php-version. Please be aware that I am the author of php-version so of course I prefer it as I wrote it to scratch my own itch (I wanted something minimal with command completion); however, phpenv is quite good as well. You would do well to use either.

On OS X, you can install a PHP version manager using Homebrew.

First, add the PHP formulae for homebrew:

% brew tap homebrew/homebrew-php

Then, using the formulae installed from homebrew-php you can install either with:

% brew install php-version

or

% brew install phpenv

The php-version README.md lists a few more alternatives so you might want to have a look.

BTW, I would consider php-version to be more aligned with chruby in that it tries to do one thing well.

like image 144
Wil Moore III Avatar answered Nov 11 '22 12:11

Wil Moore III


I think phpfarm is most close php alternative of rvm, it also installing pyrus which is like ruby gems for php world.

like image 10
wik Avatar answered Nov 11 '22 12:11

wik


If you are not use php-cgi and Install different versions of PHP to different locations

  1. Find different version libphp5.so,and copy into the different location

  2. If use php5.3.11 or php5.4.11

     ln -s php5.3.11 php  || ln -s php5.4.11
    
  3. Depoly your apache httpd.conf

     LoadModule php5_module        YOUR_PHP_PATH/php/libphp5.so
    
  4. restart apache

     sudo apachectl restart
    
like image 2
cloudsben Avatar answered Nov 11 '22 12:11

cloudsben