Link to home
Start Free TrialLog in
Avatar of DJ_AM_Juicebox
DJ_AM_Juicebox

asked on

call C++ code from PHP

Hi,

Is it possible to call functions from a c++ file from PHP? Something like:

<?php
     CallSomeCPPFunction(); // somehow precompiled and usable by PHP directly
?>

No idea how the two could communicate, just wondering if it's possible.

Thanks
Avatar of Joe Wu
Joe Wu
Flag of Australia image

Yes you should be able to call this to some extent, using the exec() function of PHP:
http://au3.php.net/function.exec

also alternatively you can use system():
http://au2.php.net/system

basically this executes any command like a commandline does.

Hope this helps.
ASKER CERTIFIED SOLUTION
Avatar of babuno5
babuno5
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
make it your C++ function a CLI, and call it using system(), exec() to execute the function
it may be possible to call and execute in command mode of php server...