After giving up on solving this last year. I made another concerted effort to resolve it this week and succeeded!
I basically needed to (a) enable the php_com_dotnet.dll to allow use of COM
and VARIANT
classes, and (b) grant default Local Activation permission to IIS_IUSRS
to allow access to the COM component. I've listed the detailed steps I took below...
Add a folder called php in the web role's bin folder
As of PHP 5.3.15 / 5.4.5, in order to use the
COM
andVARIANT
classes, the php_com_dotnet.dll needs to be enabled inside of php.ini. Previous versions of PHP enabled these extensions by default (source: http://www.php.net/manual/en/com.installation.php). In the php folder, create a php.ini file containing only the following lines...[COM_DOT_NET] extension=php_com_dotnet.dll
Create a SetDCOMPermission.reg file in the bin folder which contains the following content, to grant default Local Activation permission to
IIS_IUSRS
...[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\OLE] "DefaultLaunchPermission"=hex(3):01,00,04,80,74,00,00,00,84,00,00,00,00,00,\ 00,00,14,00,00,00,02,00,60,00,04,00,00,00,00,00,14,00,1F,00,00,00,01,01,00,\ 00,00,00,00,05,12,00,00,00,00,00,18,00,1F,00,00,00,01,02,00,00,00,00,00,05,\ 20,00,00,00,20,02,00,00,00,00,18,00,0B,00,00,00,01,02,00,00,00,00,00,05,20,\ 00,00,00,38,02,00,00,00,00,14,00,1F,00,00,00,01,01,00,00,00,00,00,05,04,00,\ 00,00,01,02,00,00,00,00,00,05,20,00,00,00,20,02,00,00,01,02,00,00,00,00,00,\ 05,20,00,00,00,20,02,00,00
I don't know if the above registry change will work for everyone, so the process I used is documented here (it essentially involved using a program called RegFromApp to record the changes made to the registry when granting default Local Activation permissions for
IIS_IUSRS
in COM Security and to save the registry changes as a .reg file into the web role's bin folder).Copy and paste the out-of-process COM component (OleAutomationFeasibilityModel.exe file) into the bin folder
Create a RegisterOleAutomationFeasibilityModel.cmd file in the bin folder to register the COM component and set the necessary permissions to launch it...
chcp 1252>NUL OleAutomationFeasibilityModel.exe /regserver regedit.exe /s SetDCOMPermission.reg exit /b 0
In the ServiceDefinition.csdef file, insert a reference to the .cmd file immediately before the closing Startup tag...
<Task commandLine="RegisterOleAutomationFeasibilityModel.cmd" executionContext="elevated" />
Publish the web role
Hope that helps someone in a similar situation!