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
DJ_AM_JuiceboxAsked:
Who is Participating?
 
babuno5Commented:
you could write a zend extension for your C++ function

Here some help related to it
http://devzone.zend.com/node/view/id/1021
0
 
nizsmoDeveloperCommented:
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.
0
 
blue_hunterTechnical ConsultantCommented:
make it your C++ function a CLI, and call it using system(), exec() to execute the function
0
 
Loganathan NatarajanLAMP DeveloperCommented:
it may be possible to call and execute in command mode of php server...
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.