Solved

call C++ code from PHP

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Wordpress Taxonomy 2 27
PHP Parse error: syntax error, unexpected '[' 1 22
ignore other .htaccess 2 43
Which userID to use for shopping cart application 13 18
Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
This article discusses four methods for overlaying images in a container on a web page
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.

815 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

8 Experts available now in Live!

Get 1:1 Help Now