Click here to Skip to main content
14,836,679 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

As apart of php upgrade form 5.5 t0 7.1. I was not able to access the dotnet dll files from php dotnet class, its throwing me the below error.

PHP Fatal error: Uncaught com_exception: Failed to instantiate .Net object [CreateInstance] [0x80131047]

Can anyone share your ideas on how to access the external dll's with dotnet object with out registering to the windows.

Thanks in advance.

What I have tried:

Push(".Net");
$stack->Push("Hello ");
echo $stack->Pop() . $stack->Pop();
$oDotNetObject = new dotnet("C:\VsProjects\WebApplication1\bin\WebApplication1.dll"," WebApplication1.Class1");
echo $oDotNetObject->ping();
?>
Posted
Updated 3-Feb-21 6:18am

1 solution

Looking at the documentation[^], the first parameter needs to be the fully qualified assembly name, not a path to the assembly.

That suggests this method only supports assemblies which are registered in the GAC.

It also doesn't support anything written for any version of .NET after 3.5.

You might be able to use the NetPhp library to accomplish what you want:
GitHub - david-garcia-garcia/netphp: .Net interoperability wrappers for PHP[^]
   
Comments
Member 15063741 5-Feb-21 11:03am
   
Hi Richad, thank you. I tried It worked.. as you said.

But, Is there any way with out registering the dll, where we can give a path to load all the dlls and get access to our application.

I went through some thing like "Building your own PHP on windows" will this help me to interact with dlls with out registering.

https://wiki.php.net/internals/windows/stepbystepbuild_sdk_2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900