This is fairly easy but need some extra work.
First you need to check that you have a php binary on your system that will work for cgi. For example in my case:
[root@control2 cgi-bin]# /usr/local/php525-fcgi/bin/php-cgi -v
PHP 5.2.5 (cgi-fcgi) (built: Nov 28 2007 12:31:32)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
with Zend Extension Manager v1.2.2, Copyright (c) 2003-2007, by Zend Technologies
with Zend Optimizer v3.3.0, Copyright (c) 1998-2007, by Zend Technologies
Next step, is create a php5.fcgi file in the given domain's cgi-bin folder. I am going to use the domain mydomain.com to make it easier.
/var/www/vhosts/mydomain.com/cgi-bin/php5.fcgi
#!/bin/sh
PHP_FCGI_CHILDREN=2
export PHP_FCGI_CHILDREN
PHP_FCGI_MAX_REQUESTS=5000
export PHP_FCGI_MAX_REQUESTS
exec /usr/local/php525-fcgi/bin/php-cgi
edit: I forgot to mention, you need to change the owner of this file to that of the domain user as well as preferably chmod 755, nothing higher and at least 500 I think to have it executable by the domain user.
Next step is configure apache but only for this specific domain.
/var/www/vhosts/mydomain.com/conf/vhost.conf
<Directory /var/www/vhosts/mydomain.com/httpdocs>
Action application/x-httpd-php5 /cgi-bin/php5.fcgi
AddType application/x-httpd-php5 .php
</Directory>
/var/www/vhosts/mydomain.com/conf/vhost_ssl.conf
<Directory /var/www/vhosts/mydomain.com/httpsdocs>
Action application/x-httpd-php5 /cgi-bin/php5.fcgi
AddType application/x-httpd-php5 .php
</Directory>
Now if those vhost.conf files didn't exist you need to run the following command first:
/usr/local/psa/admin/bin/websrvmng -av
then just double check your files that there is no problem:
httpd -t
Should give the output:
Syntax OK
Whether the vhost.conf was new or not, now reload the config files on apache (centos in my case)
/etc/init.d/httpd reload
Go create a info.php in /var/www/vhosts/mydomain.com/httpdocs with the following:
Visit
http://www.mydomain.com/info.php and verify your php version.