Setting up PEAR with MacPorts


For a long time I am a happy MacPorts user now. My standard PHP setup has always included the pear variant: port install php5 +apache2 +fastcgi +pear–until now.

When I tried out PHP 5.4 recently using an early portfile for it, I noticed it didn't have the pear variant anymore. I inquired about this and learned that there also won't be that variant anymore. Instead one should install PEAR using the separate packages provided for this. So I decided to start using this for my regular PHP 5.3 setup as well, as it seems more future proof. Works fine if one knows how to set it up.

port install pear-PEAR

That almost it. The pear command ends up in /opt/local/lib/php/pear/bin, so you want to add that to your path. Also be aware you need to reinstall PEAR packages you already had installed with the old PEAR.

The nice thing about the new setup is that everything pear-releated is in it's own directory as opposed to the mix of PEAR and other stuff I had before.

When all was set up I installed what I needed using the pear command directly, even though the MacPorts people would love you to use the already ~550 ports available with PEAR packages (see port search pear-).

Hope that helps someone.


Comments

  1. Gravatar

    Chris, I just checked my setup and I still have pear-PEAR installed (next to php53 and php54). It needs a bit of setup to have both PHP versions use the same include path, but other than that I don't remember any changes I needed to apply.

  2. Gravatar

    you have said what I need to do to install pear for php5.3 but this doesn't seem to work for php5.4 - did you do something different?

  3. Gravatar

    Wow I was looking all over for that, evidently they used to put it into /opt/local/bin and I could not figure out why it hadn't appeared in there. Thanks!

Leave a reply

Karsten Dambekalns

Creative Code Engineer

Contact / Impressum