Call a C# .net .dll script using PHP -


i have c# .net dll script calls sql stored procedure selects data in order run relevant methods.

i need run dll using php entire application built in php.

what best way of doing this?

i'm not experienced @ c#.

edit

i registered .net dll using:

regasm.exe dllname.dll /tlb:dllname.tlb 

i should able use php's com() method described below call dll's functions/methods.

but these functions still accessible through com() method .net dll registered assembly? make difference?

edit

after registering .net dll assembly error message when try call method using com():

"php fatal error:  uncaught exception 'com_exception' message 'failed  create com object `dllname.classname': invalid syntax" 

edit

tried using:

new dotnet('dllname, version=4.0.30319.33440, culture=neutral, publictokenkey=14843e0419858c21', 'classname'); 

got internal server 500 error

is because php doesn't communicate .net 4 assemblies?

option 1: use dll

you can call function using php's com class.

you'll need running php on windows, assume if you're using c# dll.

steps:

  1. register dll using command regasm yourdllname.dll in command prompt or run dialog. have 1 regasm.exe each version of .net installed on computer, make sure execute 1 version of .net dll targets running %windir%\microsoft.net\appropriateversion.
  2. create com object in php references class name of dll.
  3. call function, available method of com object you've created.

example:

$object = new com('mydllprojectname.mydllclassname'); $object->mymethod(); 

option 2: rewrite in php

as has been mentioned, cleaner, cross-platform option re-implement sql query in php directly, if reason using dll run query.


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -