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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

LordOfPortsCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.