Installing PHP 5.3 and 5.4 is really easy with HomeBrew. PHP is included with Snow Leopard and Lion, but isn’t the latest version. If you want to run a newer version of PHP, such as PHP 5.4, you can install it through HomeBrew.
Here’s a site with good instructions on installing PHP via HomeBrew.
http://justinhileman.info/article/reinstalling-php-53-on-mac-os-x/
The only change that I had to make was with the brew install command since there are now two versions supported (5.3 and 5.4).
PHP 5.3:
brew install php53 --with-mysql --with-intl
PHP 5.4:
brew install php54 --with-mysql --with-intl