(On Debian 5.0. May be slightly different on other distros)
Create files in /etc/skel/:
$ cd /etc/skel
$ mkdir -P etc/php5
$ cp /etc/php5/apache2/php.ini /etc/skel/etc/php5/php.ini
$ mkdir fcgi-bin
$ vi fcgi-bin/php5.fcgi
Paste the following:
#!/bin/bash
export PHPRC=$PWD/../etc/php5
umask 022
export SCRIPT_FILENAME=$PATH_TRANSLATED
exec /usr/bin/php-cgi
Then, in Virtualmin > System Settings > Server Templates > Default Settings > Apache website > Directives and settings:
ServerName ${DOM}
ServerAlias www.${DOM}
DocumentRoot ${HOME}/public_html
ErrorLog /var/log/virtualmin/${DOM}_error_log
CustomLog /var/log/virtualmin/${DOM}_access_log combined
DirectoryIndex index.html index.htm index.php index.php4 index.php5
Options -Indexes IncludesNOEXEC FollowSymLinks ExecCGI
allow from all
AllowOverride All
AddHandler fcgid-script .php
FCGIWrapper ${HOME}/fcgi-bin/php5.fcgi .php
AddHandler cgi-script cgi
Important notes:
ExecCGIis required! Otherwise, 403 Forbidden errors will occur.- The wrapper script and php files must not be group/world-writable!
- Look in
/var/log/apache2/suexec.logfor hints if you’re having trouble.