$ wget http://www.php.net/get/php-5.3.28.tar.gz/from/this/mirror
$ mv mirror php.5.3.28.tar.gz
$ tar xzvf php.5.3.28.tar.gz
$ cd php-5.3.28/
$ ./configure --with-openssl=shared
$ make
$ export OPENSSL_EXT_DIR=/usr/local/Cellar/php53-openssl # can be anything really as far as it matches value in the .ini file, later
$ mkdir $OPENSSL_EXT_DIR
$ cp modules/openssl.so $OPENSSL_EXT_DIR
$ cd /usr/local/etc/php/5.3/conf.d/
$ vi ext-openssl.ini
The value that ext-openssl.ini should have:
[openssl]
extension="/usr/local/Cellar/php53-openssl/openssl.so"