jmertic                                  Wed, 30 Sep 2009 13:44:28 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=288996

Log:
Bug #47855 - Change the VBScript custom actions to be deferred and not to 
impersonate the installing user, so the apache config changes are made as an 
elevated privileges user. Solves problem of not being able to install with 
Apache under Windows Vista/2008/7.

Bug: http://bugs.php.net/47855 (Assigned) VC6 Thread Safe MSI install fails
      
Changed paths:
    U   php/win-installer/trunk/PHPInstallerBase52.wxs
    U   php/win-installer/trunk/PHPInstallerBase52NTS.wxs
    U   php/win-installer/trunk/PHPInstallerBase53.wxs
    U   php/win-installer/trunk/PHPInstallerBase53NTS.wxs
    U   php/win-installer/trunk/PHPInstallerBase60.wxs
    U   php/win-installer/trunk/PHPInstallerBase60NTS.wxs
    U   php/win-installer/trunk/PHPInstallerScripts52.vbs
    U   php/win-installer/trunk/PHPInstallerScripts53.vbs
    U   php/win-installer/trunk/PHPInstallerScripts60.vbs

Modified: php/win-installer/trunk/PHPInstallerBase52.wxs
===================================================================
--- php/win-installer/trunk/PHPInstallerBase52.wxs	2009-09-30 13:32:18 UTC (rev 288995)
+++ php/win-installer/trunk/PHPInstallerBase52.wxs	2009-09-30 13:44:28 UTC (rev 288996)
@@ -708,7 +708,7 @@
       DllEntry="CAQuietExec"
       Return="ignore"
       Execute="deferred"
-      Impersonate="no" />
+      Impersonate="no" />
     <CustomAction Id="fcgiconfigJSFastCGISetActivityTimeoutCmd"
       Property="fcgiconfigJSFastCGISetActivityTimeout"
       Value="&quot;\\localhost\admin$\system32\cscript.exe&quot; &quot;[WindowsFolder]system32\inetsrv\fcgiconfig.js&quot; -set -section:&quot;PHP&quot; -ActivityTimeout:600" />
@@ -784,18 +784,34 @@
     <CustomAction Id="configIIS4"
       BinaryKey="PHPInstallerScripts"
       Return="check"
+      Execute="deferred"
+      Impersonate="no"
       VBScriptCall="configIIS4" />
+    <CustomAction Id="configIIS4CustomActionDataValue"
+      Return="check"
+      Property="configIIS4"
+      Value="[INSTALLDIR]" />
     <CustomAction Id="unconfigIIS4"
       BinaryKey="PHPInstallerScripts"
       Return="check"
+      Execute="deferred"
+      Impersonate="no"
       VBScriptCall="unconfigIIS4" />
     <CustomAction Id="configApache"
       BinaryKey="PHPInstallerScripts"
       Return="check"
+      Execute="deferred"
+      Impersonate="no"
       VBScriptCall="configApache" />
+    <CustomAction Id="configApacheCustomActionDataValue"
+      Return="check"
+      Property="configApache"
+      Value="[APACHEDIR],[INSTALLDIR]" />
     <CustomAction Id="unconfigApache"
       BinaryKey="PHPInstallerScripts"
       Return="check"
+      Execute="deferred"
+      Impersonate="no"
       VBScriptCall="unconfigApache" />

     <InstallExecuteSequence>
@@ -949,18 +965,24 @@
       <Custom Action="fcgiconfigJSFastCGIremoveXP" After="fcgiconfigJSFastCGIremoveCmdXP">
         <![CDATA[(VersionNT = 501 AND ServicePackLevel >= 2) AND &iis4FastCGI = 2]]>
       </Custom>
-      <Custom Action="configIIS4" After="InstallFinalize">
+      <Custom Action="configIIS4CustomActionDataValue" After="WriteRegistryValues">
         <![CDATA[VersionNT < 600 AND &iis4FastCGI = 3]]>
       </Custom>
+      <Custom Action="configIIS4" After="configIIS4CustomActionDataValue">
+        <![CDATA[VersionNT < 600 AND &iis4FastCGI = 3]]>
+      </Custom>
       <Custom Action="unconfigIIS4" After="InstallInitialize">
         <![CDATA[VersionNT < 600 AND &iis4FastCGI = 2]]>
       </Custom>
-      <Custom Action="unconfigApache" After="InstallValidate">
-        <![CDATA[&apache13 = 2 OR &apache20 = 2 OR &apache22 = 2 OR &apacheCGI = 2]]>
+      <Custom Action="configApacheCustomActionDataValue" After="WriteRegistryValues">
+        <![CDATA[&apache13 = 3 OR &apache20 = 3 OR &apache22 = 3 OR &apacheCGI = 3]]>
       </Custom>
-      <Custom Action="configApache" After="InstallFinalize">
+      <Custom Action="configApache" After="configApacheCustomActionDataValue">
         <![CDATA[&apache13 = 3 OR &apache20 = 3 OR &apache22 = 3 OR &apacheCGI = 3]]>
       </Custom>
+      <Custom Action="unconfigApache" After="InstallInitialize" >
+        <![CDATA[&apache13 = 2 OR &apache20 = 2 OR &apache22 = 2 OR &apacheCGI = 2]]>
+      </Custom>
       <RemoveExistingProducts After="InstallValidate" />
     </InstallExecuteSequence>


Modified: php/win-installer/trunk/PHPInstallerBase52NTS.wxs
===================================================================
--- php/win-installer/trunk/PHPInstallerBase52NTS.wxs	2009-09-30 13:32:18 UTC (rev 288995)
+++ php/win-installer/trunk/PHPInstallerBase52NTS.wxs	2009-09-30 13:44:28 UTC (rev 288996)
@@ -651,10 +651,18 @@
     <CustomAction Id="configIIS4"
       BinaryKey="PHPInstallerScripts"
       Return="check"
+      Execute="deferred"
+      Impersonate="no"
       VBScriptCall="configIIS4" />
+    <CustomAction Id="configIIS4CustomActionDataValue"
+      Return="check"
+      Property="configIIS4"
+      Value="[INSTALLDIR]" />
     <CustomAction Id="unconfigIIS4"
       BinaryKey="PHPInstallerScripts"
       Return="check"
+      Execute="deferred"
+      Impersonate="no"
       VBScriptCall="unconfigIIS4" />

     <InstallExecuteSequence>
@@ -748,9 +756,6 @@
       <Custom Action="fcgiconfigJSFastCGISetPHPRCAndMAX_REQUESTS" After="fcgiconfigJSFastCGISetPHPRCAndMAX_REQUESTSCmd">
         <![CDATA[(VersionNT = 502 AND ServicePackLevel >= 2) AND &iis4FastCGI = 3]]>
       </Custom>
-      <Custom Action="configIIS4" After="InstallFinalize">
-        <![CDATA[VersionNT < 600 AND &iis4FastCGI = 3]]>
-      </Custom>
       <Custom Action="fcgiconfigJSFastCGICmdXP" After="InstallInitialize">
         <![CDATA[(VersionNT = 501 AND ServicePackLevel >= 2) AND &iis4FastCGI = 3]]>
       </Custom>
@@ -793,6 +798,12 @@
       <Custom Action="fcgiconfigJSFastCGIremoveXP" After="fcgiconfigJSFastCGIremoveCmdXP">
         <![CDATA[(VersionNT = 501 AND ServicePackLevel >= 2) AND &iis4FastCGI = 2]]>
       </Custom>
+      <Custom Action="configIIS4CustomActionDataValue" After="WriteRegistryValues">
+        <![CDATA[VersionNT < 600 AND &iis4FastCGI = 3]]>
+      </Custom>
+      <Custom Action="configIIS4" After="configIIS4CustomActionDataValue">
+        <![CDATA[VersionNT < 600 AND &iis4FastCGI = 3]]>
+      </Custom>
       <Custom Action="unconfigIIS4" After="InstallInitialize">
         <![CDATA[VersionNT < 600 AND &iis4FastCGI = 2]]>
       </Custom>

Modified: php/win-installer/trunk/PHPInstallerBase53.wxs
===================================================================
--- php/win-installer/trunk/PHPInstallerBase53.wxs	2009-09-30 13:32:18 UTC (rev 288995)
+++ php/win-installer/trunk/PHPInstallerBase53.wxs	2009-09-30 13:44:28 UTC (rev 288996)
@@ -770,18 +770,34 @@
     <CustomAction Id="configIIS4"
       BinaryKey="PHPInstallerScripts"
       Return="check"
+      Execute="deferred"
+      Impersonate="no"
       VBScriptCall="configIIS4" />
+    <CustomAction Id="configIIS4CustomActionDataValue"
+      Return="check"
+      Property="configIIS4"
+      Value="[INSTALLDIR]" />
     <CustomAction Id="unconfigIIS4"
       BinaryKey="PHPInstallerScripts"
       Return="check"
+      Execute="deferred"
+      Impersonate="no"
       VBScriptCall="unconfigIIS4" />
     <CustomAction Id="configApache"
       BinaryKey="PHPInstallerScripts"
       Return="check"
+      Execute="deferred"
+      Impersonate="no"
       VBScriptCall="configApache" />
+    <CustomAction Id="configApacheCustomActionDataValue"
+      Return="check"
+      Property="configApache"
+      Value="[APACHEDIR],[INSTALLDIR]" />
     <CustomAction Id="unconfigApache"
       BinaryKey="PHPInstallerScripts"
       Return="check"
+      Execute="deferred"
+      Impersonate="no"
       VBScriptCall="unconfigApache" />

     <InstallExecuteSequence>
@@ -935,18 +951,24 @@
       <Custom Action="fcgiconfigJSFastCGIremoveXP" After="fcgiconfigJSFastCGIremoveCmdXP">
         <![CDATA[(VersionNT = 501 AND ServicePackLevel >= 2) AND &iis4FastCGI = 2]]>
       </Custom>
-      <Custom Action="configIIS4" After="InstallFinalize">
+      <Custom Action="configIIS4CustomActionDataValue" After="WriteRegistryValues">
         <![CDATA[VersionNT < 600 AND &iis4FastCGI = 3]]>
       </Custom>
+      <Custom Action="configIIS4" After="configIIS4CustomActionDataValue">
+        <![CDATA[VersionNT < 600 AND &iis4FastCGI = 3]]>
+      </Custom>
       <Custom Action="unconfigIIS4" After="InstallInitialize">
         <![CDATA[VersionNT < 600 AND &iis4FastCGI = 2]]>
       </Custom>
-      <Custom Action="unconfigApache" After="InstallValidate">
-        <![CDATA[&apache13 = 2 OR &apache20 = 2 OR &apache22 = 2 OR &apacheCGI = 2]]>
+      <Custom Action="configApacheCustomActionDataValue" After="WriteRegistryValues">
+        <![CDATA[&apache13 = 3 OR &apache20 = 3 OR &apache22 = 3 OR &apacheCGI = 3]]>
       </Custom>
-      <Custom Action="configApache" After="InstallFinalize">
+      <Custom Action="configApache" After="configApacheCustomActionDataValue">
         <![CDATA[&apache13 = 3 OR &apache20 = 3 OR &apache22 = 3 OR &apacheCGI = 3]]>
       </Custom>
+      <Custom Action="unconfigApache" After="InstallInitialize" >
+        <![CDATA[&apache13 = 2 OR &apache20 = 2 OR &apache22 = 2 OR &apacheCGI = 2]]>
+      </Custom>
       <RemoveExistingProducts After="InstallValidate" />
     </InstallExecuteSequence>


Modified: php/win-installer/trunk/PHPInstallerBase53NTS.wxs
===================================================================
--- php/win-installer/trunk/PHPInstallerBase53NTS.wxs	2009-09-30 13:32:18 UTC (rev 288995)
+++ php/win-installer/trunk/PHPInstallerBase53NTS.wxs	2009-09-30 13:44:28 UTC (rev 288996)
@@ -584,7 +584,7 @@
       DllEntry="CAQuietExec"
       Return="ignore"
       Execute="deferred"
-      Impersonate="no" />
+      Impersonate="no" />
     <CustomAction Id="fcgiconfigJSFastCGISetActivityTimeoutCmd"
       Property="fcgiconfigJSFastCGISetActivityTimeout"
       Value="&quot;\\localhost\admin$\system32\cscript.exe&quot; &quot;[WindowsFolder]system32\inetsrv\fcgiconfig.js&quot; -set -section:&quot;PHP&quot; -ActivityTimeout:600" />
@@ -660,10 +660,18 @@
     <CustomAction Id="configIIS4"
       BinaryKey="PHPInstallerScripts"
       Return="check"
+      Execute="deferred"
+      Impersonate="no"
       VBScriptCall="configIIS4" />
+    <CustomAction Id="configIIS4CustomActionDataValue"
+      Return="check"
+      Property="configIIS4"
+      Value="[INSTALLDIR]" />
     <CustomAction Id="unconfigIIS4"
       BinaryKey="PHPInstallerScripts"
       Return="check"
+      Execute="deferred"
+      Impersonate="no"
       VBScriptCall="unconfigIIS4" />

     <InstallExecuteSequence>
@@ -757,9 +765,6 @@
       <Custom Action="fcgiconfigJSFastCGISetPHPRCAndMAX_REQUESTS" After="fcgiconfigJSFastCGISetPHPRCAndMAX_REQUESTSCmd">
         <![CDATA[(VersionNT = 502 AND ServicePackLevel >= 2) AND &iis4FastCGI = 3]]>
       </Custom>
-      <Custom Action="configIIS4" After="InstallFinalize">
-        <![CDATA[VersionNT < 600 AND &iis4FastCGI = 3]]>
-      </Custom>
       <Custom Action="fcgiconfigJSFastCGICmdXP" After="InstallInitialize">
         <![CDATA[(VersionNT = 501 AND ServicePackLevel >= 2) AND &iis4FastCGI = 3]]>
       </Custom>
@@ -802,6 +807,12 @@
       <Custom Action="fcgiconfigJSFastCGIremoveXP" After="fcgiconfigJSFastCGIremoveCmdXP">
         <![CDATA[(VersionNT = 501 AND ServicePackLevel >= 2) AND &iis4FastCGI = 2]]>
       </Custom>
+      <Custom Action="configIIS4CustomActionDataValue" After="WriteRegistryValues">
+        <![CDATA[VersionNT < 600 AND &iis4FastCGI = 3]]>
+      </Custom>
+      <Custom Action="configIIS4" After="configIIS4CustomActionDataValue">
+        <![CDATA[VersionNT < 600 AND &iis4FastCGI = 3]]>
+      </Custom>
       <Custom Action="unconfigIIS4" After="InstallInitialize">
         <![CDATA[VersionNT < 600 AND &iis4FastCGI = 2]]>
       </Custom>

Modified: php/win-installer/trunk/PHPInstallerBase60.wxs
===================================================================
--- php/win-installer/trunk/PHPInstallerBase60.wxs	2009-09-30 13:32:18 UTC (rev 288995)
+++ php/win-installer/trunk/PHPInstallerBase60.wxs	2009-09-30 13:44:28 UTC (rev 288996)
@@ -695,7 +695,7 @@
       DllEntry="CAQuietExec"
       Return="ignore"
       Execute="deferred"
-      Impersonate="no" />
+      Impersonate="no" />
     <CustomAction Id="fcgiconfigJSFastCGISetActivityTimeoutCmd"
       Property="fcgiconfigJSFastCGISetActivityTimeout"
       Value="&quot;\\localhost\admin$\system32\cscript.exe&quot; &quot;[WindowsFolder]system32\inetsrv\fcgiconfig.js&quot; -set -section:&quot;PHP&quot; -ActivityTimeout:600" />
@@ -771,18 +771,34 @@
     <CustomAction Id="configIIS4"
       BinaryKey="PHPInstallerScripts"
       Return="check"
+      Execute="deferred"
+      Impersonate="no"
       VBScriptCall="configIIS4" />
+    <CustomAction Id="configIIS4CustomActionDataValue"
+      Return="check"
+      Property="configIIS4"
+      Value="[INSTALLDIR]" />
     <CustomAction Id="unconfigIIS4"
       BinaryKey="PHPInstallerScripts"
       Return="check"
+      Execute="deferred"
+      Impersonate="no"
       VBScriptCall="unconfigIIS4" />
     <CustomAction Id="configApache"
       BinaryKey="PHPInstallerScripts"
       Return="check"
+      Execute="deferred"
+      Impersonate="no"
       VBScriptCall="configApache" />
+    <CustomAction Id="configApacheCustomActionDataValue"
+      Return="check"
+      Property="configApache"
+      Value="[APACHEDIR],[INSTALLDIR]" />
     <CustomAction Id="unconfigApache"
       BinaryKey="PHPInstallerScripts"
       Return="check"
+      Execute="deferred"
+      Impersonate="no"
       VBScriptCall="unconfigApache" />

     <InstallExecuteSequence>
@@ -936,18 +952,24 @@
       <Custom Action="fcgiconfigJSFastCGIremoveXP" After="fcgiconfigJSFastCGIremoveCmdXP">
         <![CDATA[(VersionNT = 501 AND ServicePackLevel >= 2) AND &iis4FastCGI = 2]]>
       </Custom>
-      <Custom Action="configIIS4" After="InstallFinalize">
+      <Custom Action="configIIS4CustomActionDataValue" After="WriteRegistryValues">
         <![CDATA[VersionNT < 600 AND &iis4FastCGI = 3]]>
       </Custom>
+      <Custom Action="configIIS4" After="configIIS4CustomActionDataValue">
+        <![CDATA[VersionNT < 600 AND &iis4FastCGI = 3]]>
+      </Custom>
       <Custom Action="unconfigIIS4" After="InstallInitialize">
         <![CDATA[VersionNT < 600 AND &iis4FastCGI = 2]]>
       </Custom>
-      <Custom Action="unconfigApache" After="InstallValidate">
-        <![CDATA[&apache13 = 2 OR &apache20 = 2 OR &apache22 = 2 OR &apacheCGI = 2]]>
+      <Custom Action="configApacheCustomActionDataValue" After="WriteRegistryValues">
+        <![CDATA[&apache13 = 3 OR &apache20 = 3 OR &apache22 = 3 OR &apacheCGI = 3]]>
       </Custom>
-      <Custom Action="configApache" After="InstallFinalize">
+      <Custom Action="configApache" After="configApacheCustomActionDataValue">
         <![CDATA[&apache13 = 3 OR &apache20 = 3 OR &apache22 = 3 OR &apacheCGI = 3]]>
       </Custom>
+      <Custom Action="unconfigApache" After="InstallInitialize" >
+        <![CDATA[&apache13 = 2 OR &apache20 = 2 OR &apache22 = 2 OR &apacheCGI = 2]]>
+      </Custom>
       <RemoveExistingProducts After="InstallValidate" />
     </InstallExecuteSequence>


Modified: php/win-installer/trunk/PHPInstallerBase60NTS.wxs
===================================================================
--- php/win-installer/trunk/PHPInstallerBase60NTS.wxs	2009-09-30 13:32:18 UTC (rev 288995)
+++ php/win-installer/trunk/PHPInstallerBase60NTS.wxs	2009-09-30 13:44:28 UTC (rev 288996)
@@ -590,7 +590,7 @@
       DllEntry="CAQuietExec"
       Return="ignore"
       Execute="deferred"
-      Impersonate="no" />
+      Impersonate="no" />
     <CustomAction Id="fcgiconfigJSFastCGISetActivityTimeoutCmd"
       Property="fcgiconfigJSFastCGISetActivityTimeout"
       Value="&quot;\\localhost\admin$\system32\cscript.exe&quot; &quot;[WindowsFolder]system32\inetsrv\fcgiconfig.js&quot; -set -section:&quot;PHP&quot; -ActivityTimeout:600" />
@@ -666,10 +666,18 @@
     <CustomAction Id="configIIS4"
       BinaryKey="PHPInstallerScripts"
       Return="check"
+      Execute="deferred"
+      Impersonate="no"
       VBScriptCall="configIIS4" />
+    <CustomAction Id="configIIS4CustomActionDataValue"
+      Return="check"
+      Property="configIIS4"
+      Value="[INSTALLDIR]" />
     <CustomAction Id="unconfigIIS4"
       BinaryKey="PHPInstallerScripts"
       Return="check"
+      Execute="deferred"
+      Impersonate="no"
       VBScriptCall="unconfigIIS4" />

     <InstallExecuteSequence>
@@ -763,9 +771,6 @@
       <Custom Action="fcgiconfigJSFastCGISetPHPRCAndMAX_REQUESTS" After="fcgiconfigJSFastCGISetPHPRCAndMAX_REQUESTSCmd">
         <![CDATA[(VersionNT = 502 AND ServicePackLevel >= 2) AND &iis4FastCGI = 3]]>
       </Custom>
-      <Custom Action="configIIS4" After="InstallFinalize">
-        <![CDATA[VersionNT < 600 AND &iis4FastCGI = 3]]>
-      </Custom>
       <Custom Action="fcgiconfigJSFastCGICmdXP" After="InstallInitialize">
         <![CDATA[(VersionNT = 501 AND ServicePackLevel >= 2) AND &iis4FastCGI = 3]]>
       </Custom>
@@ -808,6 +813,12 @@
       <Custom Action="fcgiconfigJSFastCGIremoveXP" After="fcgiconfigJSFastCGIremoveCmdXP">
         <![CDATA[(VersionNT = 501 AND ServicePackLevel >= 2) AND &iis4FastCGI = 2]]>
       </Custom>
+      <Custom Action="configIIS4CustomActionDataValue" After="WriteRegistryValues">
+        <![CDATA[VersionNT < 600 AND &iis4FastCGI = 3]]>
+      </Custom>
+      <Custom Action="configIIS4" After="configIIS4CustomActionDataValue">
+        <![CDATA[VersionNT < 600 AND &iis4FastCGI = 3]]>
+      </Custom>
       <Custom Action="unconfigIIS4" After="InstallInitialize">
         <![CDATA[VersionNT < 600 AND &iis4FastCGI = 2]]>
       </Custom>

Modified: php/win-installer/trunk/PHPInstallerScripts52.vbs
===================================================================
--- php/win-installer/trunk/PHPInstallerScripts52.vbs	2009-09-30 13:32:18 UTC (rev 288995)
+++ php/win-installer/trunk/PHPInstallerScripts52.vbs	2009-09-30 13:44:28 UTC (rev 288996)
@@ -6,29 +6,33 @@
     Dim objFSO
     Dim objFile

-    strDirective = vbCrLf & vbCrLf & "#BEGIN PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL" & vbCrLf
-    strApacheDir = Session.Property("APACHEDIR")
-    strPHPPath = Replace(Session.TargetPath("INSTALLDIR"),"\","/")
+    Args = Split( Session.Property("CustomActionData"), "," )
+    strApacheDir = Args(0)
+    strInstallDir = Args(1)
+
     If ( right(strApacheDir,1) <> "\" ) then
         strApacheDir = strApacheDir & "\"
     End If
+    strWebServerType = GetRegistryValue("Software\PHP","WebServerType")
+    strPHPPath = Replace(strInstallDir,"\","/")

-    If ( Session.FeatureRequestState("apacheCGI") = 3 ) Then
+    strDirective = vbCrLf & vbCrLf & "#BEGIN PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL" & vbCrLf
+    If ( strWebServerType = "apacheCGI" ) Then
         strDirective = strDirective & "ScriptAlias /php/ """ & strPHPPath & """" & vbCrLf
         strDirective = strDirective & "Action application/x-httpd-php """ & strPHPPath & "php-cgi.exe""" & vbCrLf
     End If

-    If ( Session.FeatureRequestState("apache22") = 3 ) Then
+    If ( strWebServerType = "apache22" ) Then
         strDirective = strDirective & "PHPIniDir """ & strPHPPath & """" & vbCrLf
         strDirective = strDirective & "LoadModule php5_module """ & strPHPPath & "php5apache2_2.dll""" & vbCrLf
     End If
-
-    If ( Session.FeatureRequestState("apache20") = 3 ) Then
+
+    If ( strWebServerType = "apache20" ) Then
         strDirective = strDirective & "PHPIniDir """ & strPHPPath & """" & vbCrLf
         strDirective = strDirective & "LoadModule php5_module """ & strPHPPath & "php5apache2.dll""" & vbCrLf
     End If
-
-    If ( Session.FeatureRequestState("apache13") = 3 ) Then
+
+    If ( strWebServerType = "apache13" ) Then
         strDirective = strDirective & "PHPIniDir """ & strPHPPath & """" & vbCrLf
         strDirective = strDirective & "LoadModule php5_module """ & strPHPPath & "php5apache.dll""" & vbCrLf
     End If
@@ -105,7 +109,7 @@
     Dim objFSO
     Dim objFile

-    strApacheDir = Session.Property("APACHEREGDIR")
+    strApacheDir = GetRegistryValue("Software\PHP","ApacheDir")
     If ( right(strApacheDir,1) <> "\" ) then
         strApacheDir = strApacheDir & "\"
     End If
@@ -164,17 +168,18 @@
     Dim DefaultDocuments

     fAddScriptMap = TRUE
-    strPHPPath = Session.TargetPath("INSTALLDIR")
+    strWebServerType = GetRegistryValue("Software\PHP","WebServerType")
+    strPHPPath = Session.Property("CustomActionData")
     If ( right(strPHPPath,1) <> "\" ) then
         strPHPPath = strPHPPath & "\"
     End If
-    If ( Session.FeatureRequestState("iis4CGI") = 3 ) Then
+    If ( strWebServerType = "iis4CGI" ) Then
         PHPExecutable = strPHPPath & "php-cgi.exe"
     End If
-    If ( Session.FeatureRequestState("iis4ISAPI") = 3 ) Then
+    If ( strWebServerType = "iis4ISAPI" ) Then
         PHPExecutable = strPHPPath & "php5isapi.dll"
     End If
-    If ( Session.FeatureRequestState("iis4FastCGI") = 3 ) Then
+    If ( strWebServerType = "iis4FastCGI" ) Then
         fAddScriptMap = FALSE
     End If

@@ -274,7 +279,8 @@
     'it could all go dreadfully wrong - so set error handler for graceful exits
     On Error Resume Next

-    If ( Session.FeatureRequestState("iis4FastCGI") = 2 ) Then
+    strWebServerType = GetRegistryValue("Software\PHP","WebServerType")
+    If ( strWebServerType = "iis4FastCGI" ) Then
         fRemoveScriptMap = FALSE
     End If

@@ -328,3 +334,15 @@
     Next
     GetWindowsVersion = Left(ver,3)
 End Function
+
+Function GetRegistryValue(strKeyPath,strValueName)
+    const HKEY_LOCAL_MACHINE = &H80000002
+    strComputer = "."
+
+    Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
+        strComputer & "\root\default:StdRegProv")
+
+    oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
+
+    GetRegistryValue = strValue
+End Function

Modified: php/win-installer/trunk/PHPInstallerScripts53.vbs
===================================================================
--- php/win-installer/trunk/PHPInstallerScripts53.vbs	2009-09-30 13:32:18 UTC (rev 288995)
+++ php/win-installer/trunk/PHPInstallerScripts53.vbs	2009-09-30 13:44:28 UTC (rev 288996)
@@ -6,28 +6,37 @@
     Dim objFSO
     Dim objFile

-    strDirective = vbCrLf & vbCrLf & "#BEGIN PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL" & vbCrLf
-    strApacheDir = Session.Property("APACHEDIR")
-    strPHPPath = Replace(Session.TargetPath("INSTALLDIR"),"\","/")
+    Args = Split( Session.Property("CustomActionData"), "," )
+    strApacheDir = Args(0)
+    strInstallDir = Args(1)
+
     If ( right(strApacheDir,1) <> "\" ) then
         strApacheDir = strApacheDir & "\"
     End If
+    strWebServerType = GetRegistryValue("Software\PHP","WebServerType")
+    strPHPPath = Replace(strInstallDir,"\","/")

-    If ( Session.FeatureRequestState("apacheCGI") = 3 ) Then
+    strDirective = vbCrLf & vbCrLf & "#BEGIN PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL" & vbCrLf
+    If ( strWebServerType = "apacheCGI" ) Then
         strDirective = strDirective & "ScriptAlias /php/ """ & strPHPPath & """" & vbCrLf
         strDirective = strDirective & "Action application/x-httpd-php """ & strPHPPath & "php-cgi.exe""" & vbCrLf
     End If

-    If ( Session.FeatureRequestState("apache22") = 3 ) Then
+    If ( strWebServerType = "apache22" ) Then
         strDirective = strDirective & "PHPIniDir """ & strPHPPath & """" & vbCrLf
         strDirective = strDirective & "LoadModule php5_module """ & strPHPPath & "php5apache2_2.dll""" & vbCrLf
     End If

-    'If ( Session.FeatureRequestState("apache20") = 3 ) Then
-    '    strDirective = strDirective & "PHPIniDir """ & strPHPPath & """" & vbCrLf
-    '    strDirective = strDirective & "LoadModule php5_module """ & strPHPPath & "php5apache2.dll""" & vbCrLf
-    'End If
+    If ( strWebServerType = "apache20" ) Then
+        strDirective = strDirective & "PHPIniDir """ & strPHPPath & """" & vbCrLf
+        strDirective = strDirective & "LoadModule php5_module """ & strPHPPath & "php5apache2.dll""" & vbCrLf
+    End If

+    If ( strWebServerType = "apache13" ) Then
+        strDirective = strDirective & "PHPIniDir """ & strPHPPath & """" & vbCrLf
+        strDirective = strDirective & "LoadModule php5_module """ & strPHPPath & "php5apache.dll""" & vbCrLf
+    End If
+
     strDirective = strDirective &  "#END PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL" & vbCrLf

     Set objFSO = CreateObject("Scripting.FileSystemObject")
@@ -100,7 +109,7 @@
     Dim objFSO
     Dim objFile

-    strApacheDir = Session.Property("APACHEREGDIR")
+    strApacheDir = GetRegistryValue("Software\PHP","ApacheDir")
     If ( right(strApacheDir,1) <> "\" ) then
         strApacheDir = strApacheDir & "\"
     End If
@@ -159,14 +168,18 @@
     Dim DefaultDocuments

     fAddScriptMap = TRUE
-    strPHPPath = Session.TargetPath("INSTALLDIR")
+    strWebServerType = GetRegistryValue("Software\PHP","WebServerType")
+    strPHPPath = Session.Property("CustomActionData")
     If ( right(strPHPPath,1) <> "\" ) then
         strPHPPath = strPHPPath & "\"
     End If
-    If ( Session.FeatureRequestState("iis4CGI") = 3 ) Then
+    If ( strWebServerType = "iis4CGI" ) Then
         PHPExecutable = strPHPPath & "php-cgi.exe"
     End If
-    If ( Session.FeatureRequestState("iis4FastCGI") = 3 ) Then
+    If ( strWebServerType = "iis4ISAPI" ) Then
+        PHPExecutable = strPHPPath & "php5isapi.dll"
+    End If
+    If ( strWebServerType = "iis4FastCGI" ) Then
         fAddScriptMap = FALSE
     End If

@@ -266,7 +279,8 @@
     'it could all go dreadfully wrong - so set error handler for graceful exits
     On Error Resume Next

-    If ( Session.FeatureRequestState("iis4FastCGI") = 2 ) Then
+    strWebServerType = GetRegistryValue("Software\PHP","WebServerType")
+    If ( strWebServerType = "iis4FastCGI" ) Then
         fRemoveScriptMap = FALSE
     End If

@@ -320,3 +334,15 @@
     Next
     GetWindowsVersion = Left(ver,3)
 End Function
+
+Function GetRegistryValue(strKeyPath,strValueName)
+    const HKEY_LOCAL_MACHINE = &H80000002
+    strComputer = "."
+
+    Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
+        strComputer & "\root\default:StdRegProv")
+
+    oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
+
+    GetRegistryValue = strValue
+End Function

Modified: php/win-installer/trunk/PHPInstallerScripts60.vbs
===================================================================
--- php/win-installer/trunk/PHPInstallerScripts60.vbs	2009-09-30 13:32:18 UTC (rev 288995)
+++ php/win-installer/trunk/PHPInstallerScripts60.vbs	2009-09-30 13:44:28 UTC (rev 288996)
@@ -6,29 +6,33 @@
     Dim objFSO
     Dim objFile

-    strDirective = vbCrLf & vbCrLf & "#BEGIN PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL" & vbCrLf
-    strApacheDir = Session.Property("APACHEDIR")
-    strPHPPath = Replace(Session.TargetPath("INSTALLDIR"),"\","/")
+    Args = Split( Session.Property("CustomActionData"), "," )
+    strApacheDir = Args(0)
+    strInstallDir = Args(1)
+
     If ( right(strApacheDir,1) <> "\" ) then
         strApacheDir = strApacheDir & "\"
     End If
+    strWebServerType = GetRegistryValue("Software\PHP","WebServerType")
+    strPHPPath = Replace(strInstallDir,"\","/")

-    If ( Session.FeatureRequestState("apacheCGI") = 3 ) Then
+    strDirective = vbCrLf & vbCrLf & "#BEGIN PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL" & vbCrLf
+    If ( strWebServerType = "apacheCGI" ) Then
         strDirective = strDirective & "ScriptAlias /php/ """ & strPHPPath & """" & vbCrLf
         strDirective = strDirective & "Action application/x-httpd-php """ & strPHPPath & "php-cgi.exe""" & vbCrLf
     End If

-    If ( Session.FeatureRequestState("apache22") = 3 ) Then
+    If ( strWebServerType = "apache22" ) Then
         strDirective = strDirective & "PHPIniDir """ & strPHPPath & """" & vbCrLf
         strDirective = strDirective & "LoadModule php6_module """ & strPHPPath & "php6apache2_2.dll""" & vbCrLf
     End If
-
-    If ( Session.FeatureRequestState("apache20") = 3 ) Then
+
+    If ( strWebServerType = "apache20" ) Then
         strDirective = strDirective & "PHPIniDir """ & strPHPPath & """" & vbCrLf
         strDirective = strDirective & "LoadModule php6_module """ & strPHPPath & "php6apache2.dll""" & vbCrLf
     End If
-
-    If ( Session.FeatureRequestState("apache13") = 3 ) Then
+
+    If ( strWebServerType = "apache13" ) Then
         strDirective = strDirective & "PHPIniDir """ & strPHPPath & """" & vbCrLf
         strDirective = strDirective & "LoadModule php6_module """ & strPHPPath & "php6apache.dll""" & vbCrLf
     End If
@@ -55,6 +59,7 @@
     strText = Replace(strText,"ScriptAlias /php/","#ScriptAlias /php/")
     strText = Replace(strText,"Action application/x-httpd-php","#Action application/x-httpd-php")
     strText = Replace(strText,"PHPIniDir","#PHPIniDir")
+    strText = Replace(strText,"LoadModule php5_module","#LoadModule php5_module")
     strText = Replace(strText,"LoadModule php6_module","#LoadModule php6_module")
     strText  = strText & strDirective

@@ -105,7 +110,7 @@
     Dim objFSO
     Dim objFile

-    strApacheDir = Session.Property("APACHEREGDIR")
+    strApacheDir = GetRegistryValue("Software\PHP","ApacheDir")
     If ( right(strApacheDir,1) <> "\" ) then
         strApacheDir = strApacheDir & "\"
     End If
@@ -164,17 +169,18 @@
     Dim DefaultDocuments

     fAddScriptMap = TRUE
-    strPHPPath = Session.TargetPath("INSTALLDIR")
+    strWebServerType = GetRegistryValue("Software\PHP","WebServerType")
+    strPHPPath = Session.Property("CustomActionData")
     If ( right(strPHPPath,1) <> "\" ) then
         strPHPPath = strPHPPath & "\"
     End If
-    If ( Session.FeatureRequestState("iis4CGI") = 3 ) Then
+    If ( strWebServerType = "iis4CGI" ) Then
         PHPExecutable = strPHPPath & "php-cgi.exe"
     End If
-    If ( Session.FeatureRequestState("iis4ISAPI") = 3 ) Then
+    If ( strWebServerType = "iis4ISAPI" ) Then
         PHPExecutable = strPHPPath & "php6isapi.dll"
     End If
-    If ( Session.FeatureRequestState("iis4FastCGI") = 3 ) Then
+    If ( strWebServerType = "iis4FastCGI" ) Then
         fAddScriptMap = FALSE
     End If

@@ -274,7 +280,8 @@
     'it could all go dreadfully wrong - so set error handler for graceful exits
     On Error Resume Next

-    If ( Session.FeatureRequestState("iis4FastCGI") = 2 ) Then
+    strWebServerType = GetRegistryValue("Software\PHP","WebServerType")
+    If ( strWebServerType = "iis4FastCGI" ) Then
         fRemoveScriptMap = FALSE
     End If

@@ -328,3 +335,15 @@
     Next
     GetWindowsVersion = Left(ver,3)
 End Function
+
+Function GetRegistryValue(strKeyPath,strValueName)
+    const HKEY_LOCAL_MACHINE = &H80000002
+    strComputer = "."
+
+    Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
+        strComputer & "\root\default:StdRegProv")
+
+    oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
+
+    GetRegistryValue = strValue
+End Function
-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to