HOWTO: Enable PEAR on OS-X XAMPP

The current, OS-X version of XAMPP comes with PEAR but it's not installed/configured.

Here is what you need to do:

sudo su -  [and type admin password]
/Applications/xampp/xamppfiles/lib/php/pear install PEAR
/Applications/xampp/xamppfiles/lib/php/pear install Log
/Applications/xampp/xamppfiles/lib/php/pear list 

The last command outputs the list of installed pear modules. Log should be one of them.

Once you configure pear and install Log plugin, you need to add PEAR to include_path in XAMPP's php.ini.

Edit /Applications/xampp/etc/php.ini and at the very end of the file note the lines:

1133 ;***** Added by go-pear
1134 include_path=".:/Applications/xampp/xamppfiles/lib/php"
1135 ;*****

change the configuration to read:

include_path = ".:/Applications/xampp/xamppfiles/lib/php
                 :/Applications/xampp/xamppfiles/lib/php/pear"

(comment: of course, the entire include_path must be on the same line, we had to break it at semicolon to avoid the long line destroying the page layout).

pear/ is a directory

doesn't seem to work for me:


# /Applications/xampp/xamppfiles/lib/php/pear install PEAR
-su: /Applications/xampp/xamppfiles/lib/php/pear: is a directory

Can't seem to find any surrounding documentation. Ideas?
do I need to add any paths to my PATH? (ie; is there some sort of parser thats suppose to read that command?

OS X 10.4.10 // XAMPP 0.7.0

Same Problem as above

I've had the same problem - searched but no obvious solution.

pear is a directory

this works:

cd /Applications/xampp/xamppfiles/lib/php/pear
sudo php pearcmd.php channel-update pear.php.net
sudo php pearcmd.php install PEAR

then do as telled in php.ini

Good comment

This one saved me a lot of time. Thanks for this hint.

thanks

this works fine. thank you

PEAR already installed at /usr/lib/php

Not sure why, but I already had pear set up at /usr/lib/php. You'll need to add this dir to include_path instead of Applications/xampp/xamppfiles/lib/php/pear, AND to safe_mode_include_dir as well if you have safe_mode = On:
safe_mode_include_dir = "/usr/lib/php"

If you are not sure where your pear installation is, run:
pear config-show | grep php_dir

Before all this I kept getting the file not found error too. Good luck!

Could Lead To Version Conflicts

Hueen,

sometimes PHP/PEAR is pre-installed on Linux boxes. The way you did it - you are using stock PEAR with XAMPP's PHP and you may run into version incompatibility problems. It's better/safer to use the version of PEAR that comes with XAMPP itself.

To do so, you need to disable PEAR installation already present. It's easy and can be as simple as renaming the one at /usr/lib/php to pear.bak

Also, it seems like you also have php pre-installed. You may want to disable that as well (uninstall or rename php binary).

Once you are done with disabling/renaming you can add /Applications/xampp/xamppfiles/lib/php/pear to your $PATH variable and you won't be getting "file not found" anymore.

cheers