Edit report at https://bugs.php.net/bug.php?id=33188&edit=1
ID: 33188 Comment by: ramosbs at hotmail dot com Reported by: sean at iplus dot plus dot com Summary: Cannot instantiate a DOTNET object Status: Closed Type: Bug Package: COM related Operating System: Windows 2000 PHP Version: 5CVS-2005-05-31 Assigned To: wez Block user comment: N Private report: N New Comment: I've got the same problem. And that is supposed to have been fixed in the newest version. But i'm using php 5.3.6 and I still got the same error message. Can someone tell me exactly what version of php has to be installed? (I already have the .NET framework of course) Previous Comments: ------------------------------------------------------------------------ [2007-02-21 01:14:59] s...@php.net This bug has been fixed in CVS. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. I think I fixed it in CVS (at least it works for me :) ------------------------------------------------------------------------ [2006-09-21 20:52:32] arockwell at eatonvance dot com I've been banging my head on this one for a while as well... I was looking to instantiate some .NET stuff from PHP, so at first I tried the standard example on the DOTNET man page Windows XP SP2 IIS 5 PHP 5.1.6 .NET Framework 1.1.4322 <?php $stack = new DOTNET("mscorlib", "System.Collections.Stack"); ?> Throws: Failed to instantiate .Net object [CreateInstance] [0x80070057] The parameter is incorrect. I was able to find a workaround, I compiled the functionality I wanted to be able to use into a DLL (be sure to enable COM interop, and strong namespace) with VS 6, registered it with regasm: RegAsm.exe C:\path\to\your\<dllname>.dll /tlb:<dllname>.tlb Then added it to the global assembly cache: gacutil.exe /i C:\path\to\your\<dllname>.dll (Side note, if you want to unregister/remove it from the GAC, you must cycle the IIS application pool first.) >From there you can: <?php $obj=new COM('your.strong.name'); $returnValue=$obj->yourMethod(); ?> ------------------------------------------------------------------------ [2006-07-31 14:18:16] kaspernj at gmail dot com I have spent the last two days on trying to get the DOTNET-class working. I have tried PHP 5.1, 5.2 and 6.0, which all outputted the same error-message. I am running Windows XP SP2 with the .NET Framework 2.0 (I have also tried 1.0). I have both tried the downloadable version of PHP 5.1 and the snapshot. Both 5.2 and 6.0 was from snapshot (31-07-2006). Same script as test-script as Sean (the one from the manual): <?php $stack = new DOTNET("mscorlib", "System.Collections.Stack"); $stack->Push(".Net"); $stack->Push("Hello "); echo $stack->Pop() . $stack->Pop(); ?> Expected result: Hello .Net Actual result: Fatal error: Uncaught exception 'com_exception' with message 'Failed to instantiate .Net object [CreateInstance] [0x80131522] ' in D:\phpprogs\PW-uploader\filedialog.php:2 Stack trace: #0 D:\phpprogs\PW-uploader\filedialog.php(2): dotnet->dotnet('mscorlib', 'System.Collecti...') #1 {main} thrown in D:\phpprogs\PW-uploader\filedialog.php on line 2 ------------------------------------------------------------------------ [2006-05-06 17:41:28] bvanderweb at gmail dot com I am unable to make the simple stack example work in my environment, either (same error message). I am using .NET 1.1 in Windows XP SP2. It would be really great for PHP to get this working as it does in Perl, Python, etc. ------------------------------------------------------------------------ [2005-08-29 18:28:49] hobbit at lantic dot net 5.1.0-dev (cli) - bug still present ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=33188 -- Edit this bug report at https://bugs.php.net/bug.php?id=33188&edit=1