Engine23
blogBannerImage
By Engine23

Setting up PEAR and PHING on Mac with MAMP PRO 2.0

From terminal: Install pear in home directory or cd ~ if unsure cd /Users/yourusername ( enter ) OR cd ~ ( enter )

To install/reinstall go to this site http://pear.php.net/go-pear.phar and then 'Save as...' and make sure you save this in your home directory Then in terminal run this command $ php go-pear.phar

Now make a symbolic link so you can just type in pear at the command line prompt

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

( note you may not have /usr/local/bin....you may just have /usr/bin and thats ok use that location ) Next, run these tow commands in terminal $ echo ‘export

PATH=/Users/YOUR_USER_NAME/PEAR:$PATH’ >> ~/.bash_profile $ echo ‘export PATH=/Users/YOUR_USER_NAME/bin:$PATH’ >> ~/.bash_profile

Now test to make sure that your link works in terminal type this $ pear ( enter ) You should see something like the following. Commands: build Build an Extension From C Source bundle Unpacks a Pecl Package channel-add Add a Channel channel-alias Specify an alias to a channel name channel-delete Remove a Channel From the List channel-discover Initialize a Channel from its server channel-info Retrieve Information on a Channel channel-login Connects and authenticates to remote channel server channel-logout Logs out from the remote channel server channel-update Update an Existing Channel clear-cache Clear Web Services Cache config-create Create a Default configuration file config-get Show One Setting config-help Show Information About Setting config-set Change Setting config-show Show All Settings convert Convert a package.xml 1.0 to package.xml 2.0 format cvsdiff Run a "cvs diff" for all files in a package cvstag Set CVS Release Tag download Download Package download-all Downloads each available package from the default channel info Display information about a package install Install Package list List Installed Packages In The Default Channel list-all List All Packages list-channels List Available Channels list-files List Files In Installed Package list-upgrades List Available Upgrades login Connects and authenticates to remote server [Deprecated in favor of channel-login] logout Logs out from the remote server [Deprecated in favor of channel-logout] makerpm Builds an RPM spec file from a PEAR package package Build Package package-dependencies Show package dependencies package-validate Validate Package Consistency pickle Build PECL Package remote-info Information About Remote Packages remote-list List Remote Packages run-scripts Run Post-Install Scripts bundled with a package run-tests Run Regression Tests search Search remote package database shell-test Shell Script Test sign Sign a package distribution file svntag Set SVN Release Tag uninstall Un-install Package update-channels Update the Channel List upgrade Upgrade Package upgrade-all Upgrade All Packages [Deprecated in favor of calling upgrade with no parameters] Usage: pear [options] command [command-options] <parameters> Type "pear help options" to list all options. Type "pear help shortcuts" to list all command shortcuts. Type "pear help <command>" to get the help for the specified command.( this next section is not in every MAMP installation so if its not there, just skip it )

Now edit the php.ini in MAMP to show the current installed directory mine was /Users/yourusername/pear/share/pear
You can edit the MAMP php.ini by using command line and typing
$ nano /Applications/MAMP/conf/php5.3/php.ini
then do a search by using <control> W and typing in PEAR and hit enter
You will need to hig <control> W again and hit enter for it to end up where you need to change the setting.
Now change the directory from the default to your new setting once again mine was /Users/russell/pear/share/pear/

Now make the pear folder writeable and all subfolders writeable ( i know its not the best but its on your local machine ) $ sudo chmod -R 777 /tmp/pear/ ( enter ) Now, go into php5.3 folder in terminal $ cd /Applications/MAMP/bin/php/php5.3.6/bin ( enter ) --- Now you can install PHING --- $ pear channel-discover pear.phing.info ( enter ) In terminal run this command $ pear install phing/phing ( enter ) Do a symlink for phing $ sudo ln /Users/russell/pear/bin/phing /usr/local/bin/ ( enter ) cd into etc $ cd /etc ( enter ) Copy the default php.ini $ sudo cp php.ini.default php.ini ( enter ) Now edit the ini page $ sudo nano php.ini ( enter ) You are changing this: ;;;;;;;;;;;;;;;;;;;;;;;;; ; Paths and Directories ; ;;;;;;;;;;;;;;;;;;;;;;;;; ; UNIX: "/path1:/path2" ;include_path = ".:/php/includes" To ( remove the semi colon and put in the proper path ): ;;;;;;;;;;;;;;;;;;;;;;;;; ; Paths and Directories ; ;;;;;;;;;;;;;;;;;;;;;;;;; ; UNIX: "/path1:/path2" include_path = ".:/php/includes:/Users/yourusername/pear/share/pear" Now save with <Control> + O Exit nano and go to the directory $ cd ~/your/file/location/that/has/PHING/ready/ ( enter ) Now you can utilize PHING In terminal you can run this: $ phing ( enter )