Oh. I was hoping you would say you are experienced in building and configuring things on Slackware. This isn't really something to try out on a production server, but it's your server and your risk, so here goes. It works for me on Slackware 14.0, Slackware PHP-5.4.x, and self-built PHP-5.5.x, but I don't know about your Slackware 12.1 and PHP-5.2.x.
Get php-5.5.6.tar.bz2 from php.net and unpack into any directory:
$ tar -xjf php-5.5.6.tar.bz2
$ cd php-5.5.6
Configure php. You must adjust the configure command to account for your choice of paths and which features and extensions you need. The paths you choose must not conflict with those used by the Slackware package. This is an example only, with no optional extensions:
$ ./configure --prefix=/opt/php --with-layout=GNU --with-apxs2 --disable-cgi --with-config-file-path=/opt/php/etc
Do not use make install, or it will overwrite the Apache PHP module installed with Slackware. Instead, you want to do everying "make install" does except for "make install-sapi". Then manually copy the PHP module (libphp5.so) somewhere.
# make install-modules install-binaries install-build install-headers
# make install-programs install-pharcmd
# cp .libs/libphp5.so /opt/php/lib/
Make a php.ini file - either use your existing file or the supplied template.
# mkdir /opt/php/etc
# cp php.ini-production /opt/php/etc/php.ini
# cp /etc/httpd/php.ini /opt/php/etc/php.ini
Note: If using the template php.ini-production, you need to edit it to set your timezone.
Configure your second Apache instance.
# cd /etc/httpd
# cp httpd.conf httpd.test.conf
Edit httpd.test.conf and make the following changes:
1) Change the "Listen" line(s) to listen on the new port. Example:
2) Change the paths in ErrorLog, CustomLog, and/or TransferLog to use filenames that are different, for example:
CustomLog "/var/log/httpd/test_access_log" common
3) Change or add a PidFile line to use a unique name. For example:
(If adding the line, you can add this right after ServerRoot.)
4) Change the line which loads the PHP module to have the full path. Note: As supplied by Slackware, the PHP module loading is done from a file "mod_php.conf" which is included into httpd.conf. If this is what you have, comment out the line "Include /etc/httpd/mod_php.conf" and replace it with these two lines:
LoadModule php5_module /opt/php/lib/libphp5.so
AddType application/x-httpd-php .php
Now start your second Apache instance:
# /usr/sbin/httpd -f /etc/httpd/httpd.test.conf -k start
Check by pointing your browser to http://example.com:8080 - this will get you the same served files but with PHP-5.5.x.
Note: Apache and PHP each have a huge number of configuration options, and some of those might require additional configuration steps to keep two instances of Apache running without conflict.