RVM equivalent for PHP?

前端 未结 7 1845
逝去的感伤
逝去的感伤 2021-01-30 10:07

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.

7条回答
  •  醉酒成梦
    2021-01-30 10:44

    if you're running apache I can suggest the way I solved this. Install different versions of PHP to different locations and prepare few apache php-x.y.z.conf files like

    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"
    
        Order allow,deny
        Allow from all
    
    

    ,

    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"
    
        Order allow,deny
        Allow from all
    
    

    and so on, so you can quickly change the name of included .conf file and restart server. Or, like I did, make several virtual hosts having the same document root, but with different versions of PHP included:

    
        DocumentRoot "C:/www/localhost"
        ServerName local.php-5.2.10
    
        Include conf/php-5.2.10.conf
    
        
            Allow from All
        
    
    

提交回复
热议问题