diff --git a/WebsitePanel/Database/install_db.sql b/WebsitePanel/Database/install_db.sql index d18ecb79..47bb884f 100644 --- a/WebsitePanel/Database/install_db.sql +++ b/WebsitePanel/Database/install_db.sql @@ -42964,11 +42964,11 @@ INSERT [dbo].[ServiceDefaultProperties] ([ProviderID], [PropertyName], [Property GO INSERT [dbo].[ServiceDefaultProperties] ([ProviderID], [PropertyName], [PropertyValue]) VALUES (101, N'PerlPath', N'%SYSTEMDRIVE%\Perl\bin\PerlEx30.dll') GO -INSERT [dbo].[ServiceDefaultProperties] ([ProviderID], [PropertyName], [PropertyValue]) VALUES (101, N'Php4Path', N'%PROGRAMFILES%\PHP\php.exe') +INSERT [dbo].[ServiceDefaultProperties] ([ProviderID], [PropertyName], [PropertyValue]) VALUES (101, N'Php4Path', N'%PROGRAMFILES(x86)%\PHP\php.exe') GO INSERT [dbo].[ServiceDefaultProperties] ([ProviderID], [PropertyName], [PropertyValue]) VALUES (101, N'PhpMode', N'FastCGI') GO -INSERT [dbo].[ServiceDefaultProperties] ([ProviderID], [PropertyName], [PropertyValue]) VALUES (101, N'PhpPath', N'%PROGRAMFILES%\PHP\php-cgi.exe') +INSERT [dbo].[ServiceDefaultProperties] ([ProviderID], [PropertyName], [PropertyValue]) VALUES (101, N'PhpPath', N'%PROGRAMFILES(x86)%\PHP\php-cgi.exe') GO INSERT [dbo].[ServiceDefaultProperties] ([ProviderID], [PropertyName], [PropertyValue]) VALUES (101, N'ProtectedGroupsFile', N'.htgroup') GO @@ -43014,11 +43014,11 @@ INSERT [dbo].[ServiceDefaultProperties] ([ProviderID], [PropertyName], [Property GO INSERT [dbo].[ServiceDefaultProperties] ([ProviderID], [PropertyName], [PropertyValue]) VALUES (105, N'PerlPath', N'%SYSTEMDRIVE%\Perl\bin\PerlEx30.dll') GO -INSERT [dbo].[ServiceDefaultProperties] ([ProviderID], [PropertyName], [PropertyValue]) VALUES (105, N'Php4Path', N'%PROGRAMFILES%\PHP\php.exe') +INSERT [dbo].[ServiceDefaultProperties] ([ProviderID], [PropertyName], [PropertyValue]) VALUES (105, N'Php4Path', N'%PROGRAMFILES(x86)%\PHP\php.exe') GO INSERT [dbo].[ServiceDefaultProperties] ([ProviderID], [PropertyName], [PropertyValue]) VALUES (105, N'PhpMode', N'FastCGI') GO -INSERT [dbo].[ServiceDefaultProperties] ([ProviderID], [PropertyName], [PropertyValue]) VALUES (105, N'PhpPath', N'%PROGRAMFILES%\PHP\php-cgi.exe') +INSERT [dbo].[ServiceDefaultProperties] ([ProviderID], [PropertyName], [PropertyValue]) VALUES (105, N'PhpPath', N'%PROGRAMFILES(x86)%\PHP\php-cgi.exe') GO INSERT [dbo].[ServiceDefaultProperties] ([ProviderID], [PropertyName], [PropertyValue]) VALUES (105, N'ProtectedGroupsFile', N'.htgroup') GO diff --git a/WebsitePanel/Database/update_db.sql b/WebsitePanel/Database/update_db.sql index 3a409483..d3669869 100644 --- a/WebsitePanel/Database/update_db.sql +++ b/WebsitePanel/Database/update_db.sql @@ -6070,3 +6070,15 @@ SELECT WHERE [RDSCollectionId] in (SELECT [ID] FROM [RDSCollections] where [ItemId] = @ItemId ) RETURN GO + + +-- wsp-10269: Changed php extension path in default properties for IIS70 and IIS80 provider +update ServiceDefaultProperties +set PhpPath='%PROGRAMFILES(x86)%\PHP\php-cgi.exe' +where ProviderId in(101, 105) + +update ServiceDefaultProperties +set Php4Path='%PROGRAMFILES(x86)%\PHP\ph.exe' +where ProviderId in(101, 105) + +GO diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Web.IIS70/Extensions/ExtensionsModuleService.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Web.IIS70/Extensions/ExtensionsModuleService.cs index 227001e3..7280b257 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Web.IIS70/Extensions/ExtensionsModuleService.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Web.IIS70/Extensions/ExtensionsModuleService.cs @@ -28,67 +28,50 @@ namespace WebsitePanel.Providers.Web.Iis.Extensions { - using Providers.Utils; + using Handlers; using Common; using Microsoft.Web.Administration; - using Microsoft.Web.Management.Server; - using System; - using System.Collections; using System.Collections.Generic; - using System.Text; - using System.Text.RegularExpressions; - using Microsoft.Win32; -using System.Collections.Specialized; internal sealed class ExtensionsModuleService : ConfigurationModuleService { - public const string PathAttribute = "path"; - - // Mappings collection to properly detect ISAPI modules registered in IIS. - static NameValueCollection ISAPI_MODULES = new NameValueCollection - { - // Misc - { Constants.AspPathSetting, @"\inetsrv\asp.dll" }, - // ASP.NET x86 - { Constants.AspNet11PathSetting, @"\Framework\v1.1.4322\aspnet_isapi.dll" }, - { Constants.AspNet20PathSetting, @"\Framework\v2.0.50727\aspnet_isapi.dll" }, - { Constants.AspNet40PathSetting, @"\Framework\v4.0.30128\aspnet_isapi.dll" }, - // ASP.NET x64 - { Constants.AspNet20x64PathSetting, @"\Framework64\v2.0.50727\aspnet_isapi.dll" }, - { Constants.AspNet40x64PathSetting, @"\Framework64\v4.0.30128\aspnet_isapi.dll" } - }; - - public SettingPair[] GetISAPIExtensionsInstalled(ServerManager srvman) + public SettingPair[] GetExtensionsInstalled(ServerManager srvman) { - List settings = new List(); - // + var settings = new List(); var config = srvman.GetApplicationHostConfiguration(); - // - var section = config.GetSection(Constants.IsapiCgiRestrictionSection); - // - foreach (var item in section.GetCollection()) - { - var isapiModulePath = Convert.ToString(item.GetAttributeValue(PathAttribute)); - // - for (int i = 0; i < ISAPI_MODULES.Keys.Count; i++) - { - var pathExt = ISAPI_MODULES.Get(i); - // - if (isapiModulePath.EndsWith(pathExt)) - { - settings.Add(new SettingPair - { - // Retrieve key name - Name = ISAPI_MODULES.GetKey(i), - // Evaluate ISAPI module path - Value = isapiModulePath - }); - // - break; - } - } - } - // + + var handlersSection = (HandlersSection) config.GetSection(Constants.HandlersSection, typeof (HandlersSection)); + + var executalbesToLookFor = new[] + { + // Perl + new KeyValuePair(Constants.PerlPathSetting, "\\perl.exe"), + // Php + new KeyValuePair(Constants.Php4PathSetting, "\\php.exe"), + new KeyValuePair(Constants.PhpPathSetting, "\\php-cgi.exe"), + // Classic ASP + new KeyValuePair(Constants.AspPathSetting, @"\inetsrv\asp.dll"), + // ASP.NET + new KeyValuePair(Constants.AspNet11PathSetting, @"\Framework\v1.1.4322\aspnet_isapi.dll"), + new KeyValuePair(Constants.AspNet20PathSetting, @"\Framework\v2.0.50727\aspnet_isapi.dll"), + new KeyValuePair(Constants.AspNet40PathSetting, @"\Framework\v4.0.30319\aspnet_isapi.dll"), + // ASP.NET x64 + new KeyValuePair(Constants.AspNet20x64PathSetting, @"\Framework64\v2.0.50727\aspnet_isapi.dll"), + new KeyValuePair(Constants.AspNet40x64PathSetting, @"\Framework64\v4.0.30319\aspnet_isapi.dll"), + }; + + foreach (var handler in handlersSection.Handlers) + { + foreach (var valuePair in executalbesToLookFor) + { + var key = valuePair.Key; + if (handler.ScriptProcessor.EndsWith(valuePair.Value) && !settings.Exists(s => s.Name == key)) + { + settings.Add(new SettingPair{Name = valuePair.Key, Value = handler.ScriptProcessor}); + } + } + } + return settings.ToArray(); } } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Web.IIS70/IIs70.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Web.IIS70/IIs70.cs index 0b875115..3f83a44d 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Web.IIS70/IIs70.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Web.IIS70/IIs70.cs @@ -100,6 +100,9 @@ namespace WebsitePanel.Providers.Web public const string AspNet20x64PathSetting = "AspNet20x64Path"; public const string AspNet40PathSetting = "AspNet40Path"; public const string AspNet40x64PathSetting = "AspNet40x64Path"; + public const string PerlPathSetting = "PerlPath"; + public const string Php4PathSetting = "Php4Path"; + public const string PhpPathSetting = "PhpPath"; public const string WEBSITEPANEL_IISMODULES = "WebsitePanel.IIsModules"; public const string DOTNETPANEL_IISMODULES = "DotNetPanel.IIsModules"; @@ -3409,7 +3412,7 @@ namespace WebsitePanel.Providers.Web using (ServerManager srvman = webObjectsSvc.GetServerManager()) { - allSettings.AddRange(extensionsSvc.GetISAPIExtensionsInstalled(srvman)); + allSettings.AddRange(extensionsSvc.GetExtensionsInstalled(srvman)); // add default web management settings WebManagementServiceSettings wmSettings = GetWebManagementServiceSettings();