Solved

call C++ code from PHP

Posted on 2007-11-20
4
2,013 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Consider the following scenario: You are working on a website and make something great - something that lets the server work with information submitted by your users. This could be anything, from a simple guestbook to a e-Money solution. But what…
Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php (http://lmgtfy.com?q=how+easy+is+php)  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
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.

708 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now