I have a project that needs to access a DLL with PHP. The server is a Windows machine and the Apache server is provided by XAMPP.
I read multiple answers on the web like
Here is how I call the DLL in HTA
/ Javascript
:
<object style="display:none" id="SOME_ID" classid="clsid:SOME_CLASS_ID" codebase="./somePath.dll"></object>
Does someone have a working example?
Here is what I tried so far in PHP:
$obj = new COM('pathTo.dll');
Information on the DLL:
the DllRegister Server entry point was not found
when I try to register the DLL with regsvr32
Can it be used without registering it with regsvr32
?
When you create your DLL file, you need to use a module definition file. It will contain something similar to this:
;
;contains the list of functions that are being exported from this DLL
;
DESCRIPTION "Simple COM object"
EXPORTS
DllGetClassObject PRIVATE
DllCanUnloadNow PRIVATE
DllRegisterServer PRIVATE
DllUnregisterServer PRIVATE
That definition allows regsvr32 to find the DllRegisterServer entry point.
Another option you can try is to pass the /n flag to regsvr32.
Regsvr32 [/u] [/n] [/i[:cmdline]] dllname
/u - Unregister server
/i - Call DllInstall passing it an optional [cmdline]; when used with /u calls dll uninstall
/n - do not call DllRegisterServer; this option must be used with /i
/s – Silent; display no message boxes (added with Windows XP and Windows Vista)
Ultimately, before you try to make a DLL work with PHP, you need to be sure your DLL works in general.
I had the same problem and i fixed some steps :
C:\Windows\system32\regsvr32 xwizards.dll
(it's example) now write into your PHP code :
try {
$dll = new COM('<theNameOfDllFile>.<NameOfTheClass>'); //without extension '.dll' for theNameOfDllFile
$dll->Function();
} catch(Exception $e){
echo 'error: ' . $e->getMessage(), "\n";}
Now if you know how manage the class and the function of you're dll it's going ok,however no error massage should show up on your screen
If i wasn't clear let me know and i'll do my best the next time :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With