On Jan 14, 2010, at 12:03, Craig Hoffman wrote:

> Quick question:  is it possible to install both PHP 5.3 and 5.2.x and toggle 
> between the two?  Currently, our web server is running 5.2.x and our 
> development server is running 5.3.  What's the best way to go about this? 

Yes, you can install PHP 5.3 using the php5 port and PHP 5.2 using the php52 
port. At this time, both cannot be active simultaneously, so to switch between 
them you would need to "sudo port deactivate" the one and "sudo port activate" 
the other and then restart your web server. Any PHP extensions you have 
installed will only be compatible with the version of PHP you installed them 
with, and will not be loadable in the other version until they're recompiled. 
You may also need to keep two php.ini's and switch them out as well, or else 
make sure any directives you use are usable on both versions.

The request to allow php5 and php52 to be installed and usable simultaneously 
is filed here:

http://trac.macports.org/ticket/22668

This is a reasonable request, since it is already possible to install php4 
simultaneously with php5 or php52, and even to use them simultaneously if 
you're using FastCGI and not the Apache module. I have this set up quite nicely 
on my system with the lighttpd web server instead of Apache; it has very 
flexible configuration syntax that lets you specify exactly when and where 
which PHP version gets used. For example I generally use PHP 5, but one site I 
designed has to be deployed on PHP 4, so I set my lighttpd.conf to use PHP 4 on 
just that site on my development machine so I don't accidentally use any PHP 5 
functions in it.

I should probably do some rearranging of the directories where php4, php5 and 
php52 install files, so they don't conflict with one another. But I haven't had 
time to look into this yet.


_______________________________________________
macports-users mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macports-users

Reply via email to