Re: Calling some DLL functions from within PHP (no ASP)
| From: | Paulo Parola | Date: | Tue, 28 Nov 2000 21:58:42 +0000 |
| Subject: | Re: Calling some DLL functions from within PHP (no ASP) | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-27690@lists.php.net to get a copy of this message | ||
Thanks Lars for your help. Anyway, I just wanted to share with you all the
following information (also if anybody has comments about the following
issues.....):
This was indeed exactly what I was looking for. Unfortunately I could not
get the functions to work. All COM component functions such as 'com_load',
'com_invoke', etc. yield 'undefined function fatal errors' at my
installation which has the following characteristics as reported by
php_info()
PHP Version 4.0.2
System Windows 95/98 4.10
Server API CGI
Apache/1.3.12 (Win32)
COM configuration:
--
Directive: allow_dcom
Local value: Off
Master Value: Off
* I could turn this directive to On just by editing "php.ini" *
--
Directive: typelib_file
Local Value: no value
Master Value: no value
* I could find the file 'typelib.dll' under c:\windows\system, but I could
not manage to set its value. I tried: "typelib_file=typelib.dll" * Any
hints????? What is this 'typelib_file' directive anyway?
--
The solution I got to make work was the following:
$Xvar = new COM("name_of_dll.object_name");
$output = Xvar->dll_function(parameter1, parameter2, ...);
Actually, the Visual Basic example previously given was wrongly written. The
following original posted code:
Set Xvar = CreateObject("third_party_dll")
should actually read as below:
Set Xvar = CreateObject("third_party_dll.object_name")
---
The above code *does not appear anywhere in the PHP docs* (just in user's
comments). Could someone explain exactly what is happening by using the 'new
COM()' sintax?
TIA,
Paulo Parola
----- Original Message -----
From: Lars Holm Nielsen <lars@hankat.dk>
To: <php@brazilinfo.com>; <php-general@lists.php.net>
Sent: Tuesday, November 28, 2000 4:31 AM
Subject: RE: [PHP] Calling some DLL functions from within PHP (no ASP)
> Try to look at http://www.php.net/manual/ref.com.php
>
> Isn't it what you're looking for?
>
> ---
> Regards/Mvh.
> Lars Holm Nielsen <lars@hankat.dk>
>
> > -----Original Message-----
> > From: php@brazilinfo.com [mailto:php@brazilinfo.com]
> > Sent: 27. november 2000 21:00
> > To: php-general@lists.php.net
> > Subject: [PHP] Calling some DLL functions from within PHP (no ASP)
> >
> >
> > Hi!
> >
> > I need to call some functions that reside inside a .DLL supplied
> > by a third
> > party and which shall be used in our project (a web site mostly
> > built with
> > PHP but that will have to run on NT because of these .DLLs). We
> > will not have
> > access to the details of the implementations of DLL so that we
> > are not able
> > to port it to PHP. We shall call the functions from this DLL by
> > instantiating
> > an object and then calling the functions with the correct formatted
> > parameters.
> >
> > The code inside an ASP file would be something like:
> >
> > <%
> > ' --- activeX
> > Dim Xvar
> > Set Xvar = CreateObject("third_party_dll")
> >
> > ' --- vars parameter1, parameter2, etc. shall already
> > have values
> > ' as received from user input at a form or in a
> > hardcoded manner
> > output = Xvar.dll_function(parameter1,
> > parameter2, ...)
> >
> > Set Xvar = Nothing
> > %>
> >
> >
> > I can make a PHP form and when the user submits it I would call
> > the ASP file
> > with the above Visual Basic snippet, and then format the HTML output.
> >
> > But I would like to invoke the above DLL function from inside PHP
> > and have
> > the result available at my PHP script instead of generating the
> > HTML output
> > from inside the ASP script. This is because our system already uses a
> > complete architecture based in PHP (with templates and so on), so
> > that the
> > formatting of the output would be better built inside PHP.
> >
> > Any hints?
> >