RE: [PHP] Calling C functions
| From: | Paul Maine | Date: | Wed, 09 Oct 2002 03:30:54 +0000 |
| Subject: | RE: [PHP] Calling C functions | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-119384@lists.php.net to get a copy of this message | ||
I am including a code snippet that will aid you.
# Location of your binary.
$yourbinary = "/usr/bin/yourprogram";
# Location of the libs for your c program if needed
$yourlib = YOUR_LIB . ":" . getenv("LD_LIBRARY_PATH");
putenv("LD_LIBRARY_PATH=$yourlib");
# The args to call the binary with
# For example:
$arg1 = 10;
$arg2 = 15;
# Put together the command string
$command = "$yourbinary $arg1 $arg2";
$result =
$command;
Be sure to check the return result from your program.
Hope this helps
Paul
-----Original Message-----
From: Sharad Tiwari [mailto:sharad.tiwari@wipro.com]
Sent: Tuesday, October 08, 2002 10:07 PM
To: php-general@lists.php.net
Subject: [PHP] Calling C functions
hi all,
I have just started working on PHP ... (just a couple of days back)
I had posted a question yesterday and could not get any rep from anyone
....
My problem is this ... I have to take inputs from a web-based interface
and pass them as parameters to a C function (or an executable program)
Could anyone of you kindly let me know how can I invoke such C library
functions or executables from php.
thanks for the help in advance.
Warm Regards,
Sharad