I’m preparing to install Doctrine in order to take care of Object Relational Management within my Zend Framework projects. I use XAMPP from Apache Friends, it’s nice and simple to get up and running on pretty much every platform.

If like me you use linux quite a lot, you’ll be used to some of the commands at your disposal. OS X comes with a number of these, but it annoys me when ones I frequently use are missing. One such command is wget. Now I know we can use curl -O to the same effect, so first up I edited ~/.bash_profile and added:

alias wget='curl -O'

Now when I type wget, it will run curl, so that’s one less pain in the ass. Anyway, I’m digressing.

wget http://pear.php.net/go-pear.phar

The next thing is, Mac comes with a php installed. if you type which php, it points to /usr/bin/php. We’re going to rename it, and soft link the xampp binary instead:

mv /usr/bin/php /usr/bin/php_orig
ln -s /Application/XAMPP/xamppfiles/bin/php /usr/bin/php

A quick

php --info

should tell you from pathnames etc that you are now running from your XAMPP binary. Now we can use that php command and say:

php -d detect_unicode=0 go-pear.phar

Last thing we do is create a soft link to your /usr/bin folder

ln -s /Applications/XAMPP/xamppfiles/bin/pear /usr/bin/pear

And thats us! we are now running the XAMPP php from the command line and pear is installed and configured ready to rock! Typing in pear should show you a bunch of options!

Tune in for more! Next Stop – Doctrine!