Installing PEAR on Leopard

PHP that comes with Leopard doesn’t have PEAR. You need to install it manually. Here’s how I installed it.

  1. In Terminal, run curl http://pear.php.net/go-pear > go-pear.php. This step downloads a file need to install pear. The file will be located under your home folder, and the file name is “go-pear.php”.
  2. Run sudo php -q go-pear.php. You will be asked for your password.
  3. Follow the instruction. Default setting doesn’t cause any problem. Just your personal preference. (But, I installed the tool under /usr/local/bin.)

Now your have pear command tool installed. You can check your pear configuration by running pear config-show. As I would like to install beta packages as well as stable ones, I set preferred package state to be beta.

You can do so by running sudo pear config-set preferred_state beta. (Again you may be asked for your password.)

Here’s what I have:

Auto-discover new Channels     auto_discover    <not set>
Default Channel                default_channel  pear.php.net
HTTP Proxy Server Address      http_proxy       <not set>
PEAR server [DEPRECATED]       master_server    pear.php.net
Default Channel Mirror         preferred_mirror pear.php.net
Remote Configuration File      remote_config    <not set>
PEAR executables directory     bin_dir          /usr/local/bin
PEAR documentation directory   doc_dir          /usr/local/share/pear/docs
PHP extension directory        ext_dir          ./
PEAR directory                 php_dir          /usr/local/share/pear
PEAR Installer cache directory cache_dir        /var/folders/qo/qoHKwm05H3eGEek47+j0Hk+++TI/-Tmp-//pear/cache
PEAR data directory            data_dir         /usr/local/share/pear/data
PEAR Installer download        download_dir     /usr/local/temp/download
directory
PHP CLI/CGI binary             php_bin          /usr/bin/php
php.ini location               php_ini          <not set>
PEAR Installer temp directory  temp_dir         /usr/local/temp
PEAR test directory            test_dir         /usr/local/share/pear/tests
Cache TimeToLive               cache_ttl        3600
Preferred Package State        preferred_state  beta
Unix file mask                 umask            22
Debug Log Level                verbose          1
PEAR password (for             password         <not set>
maintainers)
Signature Handling Program     sig_bin          /usr/local/bin/gpg
Signature Key Directory        sig_keydir       /private/etc/pearkeys
Signature Key Id               sig_keyid        <not set>
Package Signature Type         sig_type         gpg
PEAR username (for             username         <not set>
maintainers)
User Configuration File        Filename         /Users/takaaki/.pearrc
System Configuration File      Filename         /private/etc/pear.conf

Now to make pear work with PHP, you need to add the pear path in your PHP include path by editing php.ini file. The path you need to include is php_dir, in my case /usr/local/share/pear.

Comments

I ran the above instructions

I ran the above instructions (and chose to also install the PEAR_Frontend_Web-beta, PEAR_Frontend_Gtk2, MDB2 options), but I can't find DB.php or WebInstaller.php.

Do you know where these would typically be installed (assuming the $prefix directory as a starting point)? Also, is there a way to perform an uninstall using go-pear?

Thanks!