How to setup PHP Pear in Mac OS X Lion

Here’s how to install PHP Pear in Mac OS X Lion 10.7 using the Apache/PHP install that comes with XCode.

Once you have PHP set up, you need to run the following installer:

[code lang=”php”]
kahwee-mba:Volumes kahwee$ sudo php /usr/lib/php/install-pear-nozlib.phar
[PEAR] Archive_Tar – installed: 1.3.7
[PEAR] Console_Getopt – installed: 1.3.0
[PEAR] Structures_Graph- installed: 1.0.4
[PEAR] XML_Util – installed: 1.2.1
[PEAR] PEAR – installed: 1.9.2
Wrote PEAR system config file at: /private/etc/pear.conf
You may want to add: /usr/lib/php/pear to your php.ini include_path

If your php.ini is in /etc/php.ini, open it using:

[code lang=”bash”]sudo nano /etc/php.ini[/code]

Should the file no exist, you may want to copy the configuration for /etc/php.ini.default over by doing the following:

[code lang=”bash”]sudo cp /etc/php.ini.default /etc/php.ini[/code]

Finally you will need to update the paths in your include_path in your php.ini:

[code lang=”php”]

; Paths and Directories ;

; UNIX: “/path1:/path2”
include_path = “.:/php/includes:/usr/lib/php/pear”

After this, you can install PHP Pear packages. This is used if you want to install Numbers_Words package:

[code lang=”bash”]sudo pear install channel://[/code]

Have fun.

Leave a Reply

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