RVM equivalent for PHP?

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

+46
ruby php homebrew rvm rbenv
Sep 01 '10 at 14:10
source share
7 answers

For PHP alternatives, RVM and rbenv you have phpbrew , phpenv and php-version . Keep in mind that I am the author of the php version, so of course I prefer this because I wrote it to scratch my own itch (I need something minimal with the completion of the command); However, phpenv is not bad either. It will also be useful for you to use.

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

First add the PHP formulas for homebrew:

% brew tap homebrew/homebrew-php

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

 % brew install php-version 

or

 % brew install phpenv 

php-version README.md contains a list of several alternatives so you can watch.

By the way, I would have thought that the php-version more aligned with chruby in that it is trying to do something well.

+30
May 30 '12 at 18:01
source share

I think phpfarm is the closest alternative to php rvm , it also installs pyrus which looks like ruby ​​stones for the php world.

+9
Jul 14 '11 at 12:41
source share

If you are not using php-cgi and install different versions of PHP in different places

  • Find another version of libphp5.so and copy to another location

  • If you are using php5.3.11 or php5.4.11

      ln -s php5.3.11 php || ln -s php5.4.11 
  • Depot your apache httpd.conf

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

      sudo apachectl restart 
+2
Feb 20 '13 at 9:36
source share

Take a look at phpenv (with php-build ). There's even a homegrown recipe if you brew tap josegonzalez/php . This is actually the PHP version of rbenv not rvm , but I think it will be easier to configure than phpfarm .

+1
Apr 17 '12 at 11:00
source share

If you are using apache, I can suggest how I solved this. Install different versions of PHP in different locations and prepare several apache php-xyzconf files, for example

 ScriptAlias /php/ "path/to/php-5.2.10/" AddType application/x-httpd-php .php AddType application/x-httpd-php .phtml Action application/x-httpd-php "/php/php-cgi" <Directory "/php/"> Order allow,deny Allow from all </Directory> 

 ScriptAlias /php/ "path/to/php-5.3.0/" AddType application/x-httpd-php .php AddType application/x-httpd-php .phtml Action application/x-httpd-php "/php/php-cgi" <Directory "/php/"> Order allow,deny Allow from all </Directory> 

etc., so you can quickly change the name of the included .conf file and restart the server. Or, like me, make several virtual hosts that have the same root directory, but with different versions of PHP:

 <VirtualHost *:80> DocumentRoot "C:/www/localhost" ServerName local.php-5.2.10 Include conf/php-5.2.10.conf <Directory "C:/www/localhost"> Allow from All </Directory> </VirtualHost> 
0
Mar 14 '11 at 13:44
source share

There is a great program for this, phpbrew. I use it actively, and I can highly recommend it.

https://github.com/phpbrew/phpbrew/wiki/Cookbook

0
Oct 31 '14 at 9:21
source share

Here is my solution ( pvers ). The single-file script is completely written in bash. If you are looking for a lightweight and easy to install PHP version manager with minimal dependencies - try;)

0
May 16 '15 at 16:23
source share



All Articles