I assume you have installed MacPorts or maybe Homebrew.

First obtain the code:

cd /usr/local/src
sudo wget http://es1.php.net/get/php-5.5.8.tar.gz/from/this/mirror -O php558.tar.gz
sudo tar -xzvf php558.tar.gz
sudo chown -R user:staff php-5.5.8
cd php-5.5.8

This is my configure options:

./configure --with-zlib --enable-intl --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-openssl --enable-mbstring --with-mcrypt=/opt/local/ --with-jpeg-dir --with-gd --enable-fpm --with-curl --without-iconv

If you obtain several errors perphas you need install some dependences like mcript, sample:

sudo port install libmcrypt

Next steps:

sudo make install

If everything was fine:

php -v
PHP 5.5.8 (cli) (built: Jan 28 2014 22:16:50) 
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies

You should define php.ini

sudo cp php.ini-production /usr/local/lib/php.ini

And uncomment this line, in my case:

date.timezone = "Europe/Madrid"

Let’s start a server

php -S localhost:3001

And you’ll see:

php558 screenshot