Re: Using C libraries and PHP - calling functions in external libraries



Otis wrote:
Currently I am running a compiled C program (called swetest) on Linux from PHP using the exec() command. This allows me to get the calculations I need. But some web hosts out there disable the exec() command and I am stuck. What are the ways in which I might be able to call the functions in swetest directly from PHP without having to rely on the PHP exec() command and its buddies like system, shell_exec(), etc., which are also disabled.

I have the following C files available:

swetest.c
libswe.a (which I guess is the created library)


On a Windows system, I can make a .dll (astro_php.dll), then call it from PHP thusly:

$obj = new COM("astro_php.astro_php_cls");
$output=$obj->Get_geo_planet("2454507.5", "2");
echo $output;


How does one do something similar on Linux instead of Windows?

Thank you.



Otis


You might try a host that allows dynamic loading of your dll via the dl() function.

--
Norman
Registered Linux user #461062
.



Relevant Pages

  • Re: exec() Silent Death
    ... trying to script that in PHP. ... an output parameter to the exec() call, ... i fyou hard coded the exec command and it works in a browser, ... //using single quotes because you dont need php to parse for special ...
    (alt.php)
  • XP exec background process
    ... I was trying to exec a background process on XP using PHP CLI, but could not get it to work. ... The "False" parameter causes the Run method to continue immediately without waiting for the command to finish. ... So I could make my PHP file exec a VBS file that does the actual background execution of my command. ...
    (comp.lang.php)
  • Re: wanna execute a bin proggy and get result
    ... >> There seems to be quite a few execution methods in PHP ... receive an integer from the completion of that command ... exec(). ...
    (comp.lang.php)
  • Using C libraries and PHP - calling functions in external libraries
    ... Currently I am running a compiled C program on Linux from PHP using the exec() command. ... What are the ways in which I might be able to call the functions in swetest directly from PHP without having to rely on the PHP execcommand and its buddies like system, shell_exec, etc., which are also disabled. ...
    (alt.php)
  • Re: IIS 6.0 on Windows Server 2003
    ... If PHP insists on using CMD.EXE to execute the shellcommand on the ... server, then no, you have no choice -- you must give read permissions to the ... this would be a security vulnerability caused by PHP. ...
    (microsoft.public.inetserver.misc)