I was wondering if there was a way to call existing C code from php?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If your C code is compiled to an executable, that executable can be executed from PHP — but I’m guessing this is not quite what you meant ?
If you want to excute C code from PHP : that is not possible… unless you compile your C code to a PHP extension.
A PHP extension is like a
.dll, on windows : it’s a library, that can export functions that can be called from PHP.If you want to learn more about writing PHP extensions, those links will probably interest you :
And, if you are really interested by the subject, and ready to spend some money on it, you could buy the book Extending and Embedding PHP (some pages are available as preview on Google Books too) ; It’s considered as the book to read when interested on this subject (In fact, I’ve bought it some time ago, and, in my opinion, it is indeed an interesting read)
BTW, the author of that book is also the author of the first four articles I linked to 😉