2011-11-29

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.

7 comments:

Anonymous said...

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!

Chris Young said...

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?

Karsten Dambekalns said...

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.

jowdjbrown said...

I must say that overall I am really impressed with this blog. It is easy to see that you are passionate about your writing.Aston Martin Chiptuning

jowdjbrown said...

Power point meaning in Hindi : Get detailed meaning of POWER POINT in Hindi language.Powerpoint In hindi

jowdjbrown said...

This is a wonderful article, Given so much info in it, These type of articles keeps the users interest in the website, and keep on sharing more. Gewinne

PHP7 Thoughts said...

Article has been really helpful and as I rarely use Mac, after visiting this website explored some of the easy to use tricks on Mac which will help in better setup of development tools on this Operating System.