Confused about installing PHP5 cli

Ryan Schmidt ryandesign at
Mon Jul 13 21:58:53 PDT 2009

On Jul 13, 2009, at 23:50, mrbigpants wrote:

> I need php5 to work in cli. I just did 'sudo port install php5' and  
> it says,
> Image error: Another version of this port (php5 @5.2.10_1+apache2 
> +macosx) is
> already active.

Correct. You already had php5 installed. You should have used "sudo  
port upgrade php5" to get php 5.3.0, instead of using "sudo port  
install" again.

Now that you have used "sudo port install", you can activate 5.3.0 by  
deactivating the 5.2.10 version and activating the 5.3.0 version.

sudo port deactivate php5 @5.2.10_1+apache2+macosx
sudo port activate php5 @5.3.0_0+apache2+macosx

> So apparently php5 is already installed as an apache module. At  
> this point,
> what must I do to get it to work on the command line? Do I have to  
> somehow
> uninstall and reinstall the port?
> (There is php available to cli currently, but it's php4.)

The php4 and php5 ports always install the php cli. It cannot be  
turned off. php5 installs it at /opt/local/bin/php while php4  
installs it at /opt/local/bin/php4.

If you do not need the apache2 module or any web support, you can  
save yourself some time next time by using the +no_web variant. See  
"port variants php5" for the list of available variants.

More information about the macports-users mailing list