tcarnes Posted May 10, 2007 Share Posted May 10, 2007 I am trying to call a .NET module from a php5 script. My code is: <?php $response = new DOTNET("Paymentech", "Response"); $transaction = new DOTNET("Paymentech", "Transaction"); ?> My script dies on the first line with the error: PHP Fatal error: Uncaught exception 'com_exception' with message 'Failed to instantiate .Net object [CreateInstance] [0x80070002] The system cannot find the file specified. ' in C:\Terry\OrdCen\PHPTEST.php:3 Stack trace: #0 C:\Terry\OrdCen\PHPTEST.php(3): dotnet->dotnet('Paymentech', 'Response') #1 {main} thrown in C:\Terry\OrdCen\PHPTEST.php on line 3 The sample VB code that came with the module states: Dim response AS Paymentech.Response Dim transaction As New Paymentech.Transaction(RequestType.CC_AUTHORIZE) This is my first real foray into .NET with PHP. Hopefully someone can help me. I believe my server is set up properly as the sample code given in the PHP manual does work: <?php $stack = new DOTNET("mscorlib", "System.Collections.Stack"); $stack->Push(".Net"); $stack->Push("Hello "); echo $stack->Pop() . $stack->Pop(); ?> And the sample compiled paymentech vb app also works. The sample vb app is in the same directory (on the server) as several paymentech dll's. Could that have something to do with this? How does my PHP script know where to get the information on the paymentech object? Thank you for any help anyone can offer! Terry Quote Link to comment Share on other sites More sharing options...
trq Posted May 10, 2007 Share Posted May 10, 2007 Im not sure what your DOTNET object looks like (its not standard), but I should imagine a call would look more like. [code=php:0]$response = new DOTNET("Paymentech.Response"); I'm not a .NET programmer but I used to do a bit of com stuff. the response object is in the Paymentech namespace. So unless your DOTNET __construct asks for the namespace and then object seperately, the above may work. Quote Link to comment Share on other sites More sharing options...
tcarnes Posted May 10, 2007 Author Share Posted May 10, 2007 I think the syntax changed in php5 and the DOTNET command. I got the syntax from the PHP Manual here: http://www.phpfreaks.com/phpmanual/page/class.dotnet.html Any other ideas? ??? Quote Link to comment Share on other sites More sharing options...
trq Posted May 10, 2007 Share Posted May 10, 2007 Sorry, no ideas really. I don't work with windows. I know though that the DOTNET class your using is not documented in the official PHP manual. Quote Link to comment Share on other sites More sharing options...
tcarnes Posted May 10, 2007 Author Share Posted May 10, 2007 How can the PHP manual at phpfreaks not be the official PHP manual? Perhaps I should go back and try doing it the old COM way. Any idea how to translate the vb passing of a construction parameter into PHP using COM? Dim transaction As New Paymentech.Transaction(RequestType.CC_AUTHORIZE) Should this look like: <?php $transaction = new COM("Paymentech.Transaction(RequestType.CC_AUTHORIZE)"); ?> Thanks again for your help! Quote Link to comment Share on other sites More sharing options...
tcarnes Posted May 15, 2007 Author Share Posted May 15, 2007 Turns out the PHP couldn't find the dll because it wasn't in the Global Assembly Cache, and I couldn't use gacutil to put it there because it didn't have a strong name. So I got around that by placing the dll in the PHP directory on the web server. My next problem is trying to pass parameters using DOTNET, but that is a subject for another post. The problem of not being able to locate the file is solved. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.