Installing PEAR on built-in PHP of Snow Leopard

If you followed my last blog post, now you have your PHP environment with missing extensions compiled and loaded. But we still lack of PEAR support.

This post has the intention to explain how to install PEAR on your default Snow Leopard PHP binary.

First open your Terminal and type these commands:

$ cd /usr/local
$ curl http://pear.php.net/go-pear.phar > go-pear.phar
$ php go-pear.phar

It will open a configuration panel. Type each number and define the correct directory. Here is my final configuration:

Below is a suggested file layout for your new PEAR installation.  To
change individual locations, type the number in front of the
directory.  Type 'all' to change all of them or simply press Enter to
accept these locations.
 
1. Installation base ($prefix)                   : /usr/local/pear
2. Temporary directory for processing            : /tmp/pear/install
3. Temporary directory for downloads             : /tmp/pear/install
4. Binaries directory                            : /usr/local/bin
5. PHP code directory ($php_dir)                 : /usr/local/pear/share/pear
6. Documentation directory                       : /usr/local/pear/docs
7. Data directory                                : /usr/local/pear/data
8. User-modifiable configuration files directory : /usr/local/pear/cfg
9. Public Web Files directory                    : /usr/local/pear/www
10. Tests directory                               : /usr/local/pear/tests
11. Name of configuration file                    : /Users/gblanco/.pearrc

Install PEAR and it would likely trigger that it could not update the php.ini file. We will fix that manually now.

Open /private/etc/php.ini and locate the include_path line. If it is not commented, update it, otherwise, expose this variable through this line:

include_path=".:/usr/local/pear/share/pear"

That’s it! Now you have PEAR configured with your built-in PHP. You’re now able to install PEAR packages without any troubles.

This entry was posted in pear, php. Bookmark the permalink.

2 Responses to Installing PEAR on built-in PHP of Snow Leopard

  1. I just wanted to specify that Guilherme had /usr/local on MAC OS X 10.6 because he installed MySQL through the official provided DMG :)
    Thanks to Guilherme for pointing me in the right direction :)

  2. Pingback: Enabling Oracle OCI8 PHP Extension on OS X Snow Leopard « Enavigo

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" cssfile="">