Install mod_fcgid (Debian/Ubuntu have it in their repos, and our GPL CentOS 4 and 5 yum repositories also have it). Rebuild Apache to have suexec_docroot set to /home (or install our package–we have them available for Debian 4.0, Ubuntu 8.04, CentOS 4 and 5, otherwise you’ll have to rebuild yourself).
Once that’s done, add to the VirtualHost section:
SuexecUserGroup "#501" "#501"
Replacing the #501 above with the UID and GID of your virtual server.
Then, in the public_html Directory section:
AddHandler fcgid-script .php
AddHandler fcgid-script .php5
FCGIWrapper /home/doxfer/fcgi-bin/php5.fcgi .php
FCGIWrapper /home/doxfer/fcgi-bin/php5.fcgi .php5
Replacing "doxfer" in the above with the home of your virtual server.
Create the directory fcgi-bin in the home directory, and create a file called php5.fcgi, containing the following:
#!/bin/sh
PHPRC=$PWD/…/etc/php5
export PHPRC
SCRIPT_FILENAME=$PATH_TRANSLATED
export SCRIPT_FILENAME
exec /usr/bin/php-cgi
Copy /etc/php.ini to the etc/php5 directory within the users home (create the directory, if it doesn’t exist, e.g. /home/doxfer/etc/php5/php.ini )
Permissions on the fcgid-wrapper should be 750 and it should be owned by the virtual server user and group.
Ownership of all application files in public_html must be set to the user and group of the virtual server user and group, and permissions must also be 750 or less (anything higher and suexec will refuse to run it).
Restart apache. Cross your fingers. Test.
Check the suexec_log and error_log if anything goes wrong.