Calling dll's from PHP

I am working with PlusMinus which is a PC based accounting application. PlusMinus has a set of 7 ComObjects which are dll's. PlusMinus requires registration of these ComObject prior to use. I have successfully written C, C++ and VB application to communicate with the ComObject but I would like to know how to call these dll's from my PHP script. If its not possible can you point me to a reliable secure workaround. I searched the knowledge base and came across a similar question but its been abandoned
sgpincAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
LordOfPortsConnect With a Mentor Commented:
This article might be very useful: http://www.nusphere.com/kb/phpmanual/faq.com.htm 

One potential solution would be write a console based application, e.g. in any .NET language, that interacts with the DLLs and assuming it is running on the same host as your web server and PHP you call the application using the shell_exec function http://us3.php.net/shell_exec so you could call it with a parameter from you PHP script:

$sAnswer = shell_exec("myapp.exe \"TestParameter\"");

// myapp.exe then interacts with the DLLs and returns e.g. some sort of value which is then assigned to the $sAnswer variable
0
 
sgpincAuthor Commented:
I have little to no experience with .net, but isn't this similar to a CGI?
0
 
LordOfPortsCommented:
The console-based executable does not have to be written in a .NET language, you can write it in any language as long as it can interact with the DLLs you mentioned so you could modify your C, C++, or VB programs you created to accept parameters and return values in the form of a console application and then through the shell_exec interact with them.

If you are interested in reviewing a .NET language you can experiment with the free Visual Studio .NET Express releases, e.g. C# .NET http://www.microsoft.com/express/vcsharp/Default.aspx or VB .NET http://www.microsoft.com/express/vcsharp/Default.aspx
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
sgpincAuthor Commented:
Thanks,

I understand. How do I pass multiple parameters using your example?

$sAnswer = shell_exec("myapp.exe \"Parameter1, Paremeter2, Parameter3...\"");

0
 
LordOfPortsCommented:
If your arguments have spaces you can call the application as follows:

$sAnswer = shell_exec("myapp.exe \"Parameter1\" \"Paremeter2\" \"Parameter3\"");

or arguments without spaces:

$sAnswer = shell_exec("myapp.exe Parameter1 Paremeter2 Parameter3");

For example calling the ping executable:

$sAnswer = shell_exec("ping -a -w 1000 www.google.com");
0
 
sgpincAuthor Commented:
Great ,

Thank you for your help.
0
 
hernst42Commented:
On Windows you could try using the COM-Object directly within php with the com extension
http://www.php.net/com

In that case you have more controll than using shell_exec
0
 
sgpincAuthor Commented:
hernst42;

I have been unsuccessful  implementing COM objects directly refer to http://www.php.net/manual/en/faq.com.php#faq.com.q1 as to why. The suggestion given by LordOfPorts works but there are limitation. I'm am still open to any suggestions the community may have. Regards...  
0
 
sgpincAuthor Commented:
After allot of searching the original answer given by LordOfPorts is correct. I created a ASP.NET interface to communicate with PlusMinus ComObjects. Thanks.
0
 
LordOfPortsCommented:
Please consider at least assigning few assistance points to me. As per sgpinc's last comment my original suggestion was correct.

Thank you very much for your consideration and time in advance!
0
 
sgpincAuthor Commented:
I agree to closing the question, I also agree that LordOfPorts should get the points.

Best regards
0
 
sgpincAuthor Commented:
Refer to this link for additional information for php limitation. http://www.php.net/manual/en/faq.com.php#faq.com.q1
0
All Courses

From novice to tech pro — start learning today.