Download the source from php.net. Then tar xzvf the tarball and read the readme and install files.
./configure to your liking. Biggest difference is that when you configure for a standalone binary, you don't want to use the "--with-apxs" option.
make
Then copy the php binary to /usr or /usr/bin.
When writing shell scripts, use /bin/php or /usr/bin/php instead of /bin/sh or /bin/bash, etc. Be sure to chmod the php scripts you write as executable.
Lacey