Engine23

Setting up pear, PHING on mac OSX 10.7.2

These instructions are for: Computer/OS: Mac 10.7.2

Install pear in home directory or use command line "cd" to change directory using terminal:
$ cd ~ ( hit enter )

You need to change permissions on a few folders ( maybe create them ) to allow write access: If the folders do not exist, from command line you create them:

$ mkdir /usr/local
$ mkdir /tmp/pear
$ mkdir /usr/bin/pear

Now via command line change the permissions:

$ sudo chmod -R 777 /usr/local/
$ sudo chmod -R 777 /tmp/pear
$ sudo chmod -R 777 /usr/lib/php
$ sudo chmod -R 777 /usr/bin/pear

(The instructions came straight from http://pear.php.net/manual/en/installation.getting.php) Now using terminal run the following:

$ wget http://pear.php.net/go-pear.phar
$ sudo php -d detect_unicode=0 go-pear.phar

make sure you change the Installation Base: ( should be option 1 ) to /usr/bin/pear As well as #5 the PHP code directory! Change #1 and #5 to:

1. Installation base ($prefix)            : /usr/bin/pear
5. PHP code direcotry($php_dir)           : /usr/lib/php
( *** NOTE the other numbers/options can be left alone with whatever is set during installation *** )

Symbolic link to use "pear" from command line:

$ sudo ln /usr/bin/pear/bin/pear /usr/local/bin

PHING: From the command line:

$ pear channel-discover pear.phing.info

Now you can install phing

$ pear install phing/phing

That should be it! HOWEVER if you get this when in terminal:

phing command not found

You need to create the executable file First I added this to my .bash_profile found if you type

$ cd ~ ( hit enter )
$ vi .bash_profile

Then you add this to that file export PATH=/usr/local/bin:/Users/russell/:$PATH export PATH=/usr/local/bin/:$PATH export PATH=/usr/bin:/usr/sbin:/usr/local/bin:$PATH export PATH="/usr/local/mysql/bin:$PATH" Next add the executable in /usr/bin/ for phing to run at command prompt

$ sudo vi phing
THEN this is your script you need to copy and paste into that newly created file
#!/bin/sh
 
# ------------------------------------------------------------------------
# The phing build script for Unix based systems
# $Id: pear-phing 478 2009-07-29 17:25:59Z mrook $
# ------------------------------------------------------------------------
 
# Change this to reflect your environment if the default value doesn't work
PHP_COMMAND="/usr/bin/php"
export PHP_COMMAND
 
# -------------------------------------------------------------------------
# Do not change anything below this line unless you know what you're doing.
# -------------------------------------------------------------------------
 
if (test -z "$PHP_COMMAND") ; then
echo "WARNING: PHP_COMMAND environment not set. (Assuming php on PATH)"
PHP_COMMAND=php
export PHP_COMMAND
fi
 
$PHP_COMMAND -d html_errors=off -qC /usr/lib/php/phing.php -logger phing.listener.AnsiColorLogger "$@"
 

Once you save this file, your good to go! You can type: phing at a command prompt and your ready to work

Share: