Virtual Host with custom PHP version (fcgi)

Below is an example of Virtual Host with custom PHP version (fcgi).

Mainly when there is no control panel in the web server.


<VirtualHost *Server IP*:80>
ServerAdmin *admin-email*
DocumentRoot /var/www/html/test/
ServerName *hostname*
ServerAlias test.*
ScriptAlias /cgi-bin/ /var/www/cgi-bin/
CustomLog /var/log/httpd/homedir.log homedir

<Directory "/">
<IfModule mod_fcgid.c>
<FilesMatch "\.php$">
SetHandler fcgid-script
FCGIWrapper '/usr/local/safe-bin/fcgid56.sh /usr/local/php5.6/etc/php.ini' .php
Options +ExecCGI
</FilesMatch>
</IfModule>

Options All
AllowOverride None
Order allow,deny
Allow from all
</directory>

CustomLog /var/log/httpd/allHomedir.bytes bytes
CustomLog /var/log/httpd/allHomedir.log combined
ErrorLog /var/log/httpd/allHomedir.error.log

</VirtualHost>

Thank you.