Installing and setting up PEAR

This post will help you get PEAR installed and up and running on your machine, there are two options to below, one describes an OXS Lion specific setup and the other is more generic.

Installing on OSX 10.7 Lion

OSX Lion already has the PEAR install bundle so there is no need to download it, open up a terminal window and enter the following commands:

cd /usr/lib/php
sudo php install-pear-nozlib.phar

 

Downloading and installing

Do not follow this part if you have just done the above steps. Otherwise enter the below into a terminal window:

curl http://pear.php.net/go-pear.phar > go-pear.php
sudo php -q go-pear.php

It will ask you to enter a new installation base ($prefix). I recommend you use /usr/local

 

Configuring PHP include path

Edit /etc/php.ini and find the line: ;include_path = ".:/php/includes". Uncomment it (remove the ; at the beginning) and add the PEAR path to it. It should end up looking similar to the below:

include_path = ".:/usr/lib/php/pear"

 

Update PEAR

Now to update the install enter the 3 commands below into the terminal window:

sudo pear channel-update pear.php.net
sudo pecl channel-update pecl.php.net
sudo pear upgrade-all

 

Install PHPUnit

Just for good measure you will probably also want to install PHPUnit, if you do then execute the below command and your ready to go.

sudo pear channel-discover pear.phpunit.de
sudo pear channel-discover pear.symfony-project.com
sudo pear install pear.phpunit.de/PHPUnit
sudo pear install phpunit/DbUnit --alldeps

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.