Macos – How to install PHP PECL extensions with Macports

macosmacportspeclPHP

I'm using PHP 5.5 installed through Macports. I'd like to add the APCu PECL library. But there's no macports package and I can't see a way to install the PEAR/PECL command line utility. So how does one add APCu (or really any PECL library) to PHP 5.5 installed via Macports?

Best Answer

I was stumbling over how to get PEAR working on MacPorts as well. It turns out that I installed it somehow (possibly with the core PHP package, php54 with the default variants in my caseā€¦?), but MacPorts didn't put the binary in a normal $PATH location, so my shell couldn't find it. It was hanging out in /opt/local/lib/php/pear/bin/pear. A simple ln -s /opt/local/lib/php/pear/bin/pear /opt/local/bin/pear and a rehash (that bit might be a tcsh-ism), and I was in business.

Related Question