Edit report at http://bugs.php.net/bug.php?id=53140&edit=1
ID: 53140 Comment by: davidphp at limegreensocks dot com Reported by: jeyb88 at gmail dot com Summary: PHP-CGI (FastCGI IIS) crashes when creating DOTNET instance every second time Status: Open Type: Bug Package: COM related Operating System: XP, Vista, Win 7,Win Server 2008 PHP Version: 5.3.3 Block user comment: N Private report: N New Comment: It appears this behavior was intentionally introduced by WEZ back in 2003. http://svn.php.net/viewvc/php/php-src/trunk/ext/com_dotnet/com_dotnet.c?r1=137794&r2=146718 I don't know what problem he was trying to fix back then, so I'm not sure of the implications of adding these two lines back. But if you are using fastcgi, then jeyb88 is absolutely correct: this will crash every other time the code is run. My repro is even simpler than jeyb88's. I don't even have to call any methods on the .net object. I have a 1 line php file that calls the "new" against my .net class: <?php $class1 = new DOTNET("moo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=14ba337483520f7a", "moo.Impersonation"); ?> The constructor for my .net class is empty: [ComVisible(true), ClassInterface(ClassInterfaceType.None), Guid("53C74B01-EC09-45a4-A741-42727858B2A1")] public class Impersonation { public Impersonation() { } // more code follows When I first browse to the page, it (correctly) shows nothing. Then I hit refresh, and I get the "FastCGI process exited unexpectedly" 0xc0000005. If I hit refresh again, the page again (correctly) shows nothing, next time, fastcgi AVs again. I am using php 5.3.3, Windows Server 2003, and I have tried both .Net 2.0 and .Net 3.5. The pattern here is easily reproducible, causes an unrecoverable access violation, and there is no workaround. A fix here would be greatly appreciated. Previous Comments: ------------------------------------------------------------------------ [2010-10-22 15:59:15] jeyb88 at gmail dot com Description: ------------ The php-cgi.exe will crash after every second refresh when I make an instance of the DOTNET class. The Website is hostet via IIS 7 and PHP is configured as FastCGI module. When I configure PHP on IIS as CGI module everything works fine, but I can not do without FastCGI. I have made a change in the com_dotnet.c file in function php_com_dotnet_rshutdown. The variable called stuff from type dotnet_runtime_stuff will not be released like in the function php_com_dotnet_mshutdown. So I have added this two lines to the function php_com_dotnet_rshutdown: free(stuff); COMG(dotnet_runtime_stuff) = NULL; After that I have compiled PHP 5.3.3 with Visual Studio 2008 (VC9) x86 with almost the same configuration like in the PHP 5.3.3 nts version but without zlib: configure "--enable-snapshot-build" "--enable-debug-pack" "--disable-zts" "--disable-isapi" "--disable-nsapi" "--without-mssql" "--without-pdo-mssql" "--without-pi3web" "--with-pdo-oci" "--with-oci8" "--with-oci8-11g" "--with-enchant=shared" "--enable-object-out-dir=../obj/" "--enable-com-dotnet" "--with-mcrypt=static" "--disable-zlib" The include and lib files are relative to the configuration file (in the deps folder). I have earned following error and that's why I have disabled zlib: php5.dll.def : error LNK2001: unresolved external symbol compressBound php5.dll.def : error LNK2001: unresolved external symbol deflateBound php5.dll.def : error LNK2001: unresolved external symbol deflatePrime php5.dll.def : error LNK2001: unresolved external symbol gzclearerr php5.dll.def : error LNK2001: unresolved external symbol gzungetc php5.dll.def : error LNK2001: unresolved external symbol inflateBack php5.dll.def : error LNK2001: unresolved external symbol inflateBackEnd php5.dll.def : error LNK2001: unresolved external symbol inflateBackInit_ php5.dll.def : error LNK2001: unresolved external symbol inflateCopy php5.dll.def : error LNK2001: unresolved external symbol zlibCompileFlags The error in the com_dotnet.c file was the error, because now with the new compiled version, fastcgi will not be terminated. Is the zlib extension necessary for complex php websites like Joomla? Because now the compiled php version can interpret the sample shown below and it can interpret simple php scripts, but when I try to load a Joomla site, the FastCGI will crash. What is wrong with the made configuration? Can you give me an important hint of how to compile php5.3.3 like in the original php version? Best regards, JeyB Test script: --------------- <?php try { $stack = new DOTNET("mscorlib", "System.Collections.Stack"); $stack->Push(".Net"); $stack->Push("Hello "); echo $stack->Pop() . $stack->Pop(); } catch(Exception $lEx) { echo "Error occurred:<br>".$lEx->getMessage(); } ?> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=53140&edit=1