From 62b385fcdae1fbbad37548626f48ed8c33db9ba9 Mon Sep 17 00:00:00 2001
From: ftimme <ft@falkotimme.com>
Date: Tue, 06 Mar 2012 14:42:09 -0500
Subject: [PATCH] - Added support for multiple PHP versions (Apache + PHP-FastCGI).

---
 server/plugins-available/apache2_plugin.inc.php |   21 +++++++++++++++++++--
 1 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/server/plugins-available/apache2_plugin.inc.php b/server/plugins-available/apache2_plugin.inc.php
index 66940a5..e9a66c4 100644
--- a/server/plugins-available/apache2_plugin.inc.php
+++ b/server/plugins-available/apache2_plugin.inc.php
@@ -909,15 +909,32 @@
 			$fcgi_tpl = new tpl();
 			$fcgi_tpl->newTemplate('php-fcgi-starter.master');
 			
+			// Support for multiple PHP versions (FastCGI)
+			if(trim($data['new']['fastcgi_php_version']) != ''){
+				$default_fastcgi_php = false;
+				list($custom_fastcgi_php_name, $custom_fastcgi_php_executable, $custom_fastcgi_php_ini_dir) = explode(';', trim($data['new']['fastcgi_php_version']));
+				if(substr($custom_fastcgi_php_ini_dir,-1) != '/') $custom_fastcgi_php_ini_dir .= '/';
+			} else {
+				$default_fastcgi_php = true;
+			}
+			
 			if($has_custom_php_ini) {
 				$fcgi_tpl->setVar('php_ini_path',escapeshellcmd($custom_php_ini_dir));
 			} else {
-				$fcgi_tpl->setVar('php_ini_path',escapeshellcmd($fastcgi_config['fastcgi_phpini_path']));
+				if($default_fastcgi_php){
+					$fcgi_tpl->setVar('php_ini_path',escapeshellcmd($fastcgi_config['fastcgi_phpini_path']));
+				} else {
+					$fcgi_tpl->setVar('php_ini_path',escapeshellcmd($custom_fastcgi_php_ini_dir));
+				}
 			}
 			$fcgi_tpl->setVar('document_root',escapeshellcmd($data['new']['document_root']));
 			$fcgi_tpl->setVar('php_fcgi_children',escapeshellcmd($fastcgi_config['fastcgi_children']));
 			$fcgi_tpl->setVar('php_fcgi_max_requests',escapeshellcmd($fastcgi_config['fastcgi_max_requests']));
-			$fcgi_tpl->setVar('php_fcgi_bin',escapeshellcmd($fastcgi_config['fastcgi_bin']));
+			if($default_fastcgi_php){
+				$fcgi_tpl->setVar('php_fcgi_bin',escapeshellcmd($fastcgi_config['fastcgi_bin']));
+			} else {
+				$fcgi_tpl->setVar('php_fcgi_bin',escapeshellcmd($custom_fastcgi_php_executable));
+			}
 			$fcgi_tpl->setVar('security_level',intval($web_config['security_level']));
 
 			$php_open_basedir = ($data['new']['php_open_basedir'] == '')?$data['new']['document_root']:$data['new']['php_open_basedir'];

--
Gitblit v1.9.1