Solved

call C++ code from PHP

Posted on 2007-11-20
4
2,016 Views
Last Modified: 2008-02-01
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
0
Comment
Question by:DJ_AM_Juicebox
4 Comments
 
LVL 21

Expert Comment

by:nizsmo
ID: 20325958
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
 
LVL 15

Accepted Solution

by:
babuno5 earned 500 total points
ID: 20325982
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
 
LVL 9

Expert Comment

by:blue_hunter
ID: 20326222
make it your C++ function a CLI, and call it using system(), exec() to execute the function
0
 
LVL 36

Expert Comment

by:Loganathan Natarajan
ID: 20326239
it may be possible to call and execute in command mode of php server...
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
The viewer will learn how to count occurrences of each item in an array.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question