Integrating C in web apps
I'm still tweaking the algorithm, but what most people have told me is to get closer to the hardware and write the CPU-intensive part in C. Makes sense, and I can write the C code, but I'm not sure about how to make it fit with the rest of the site, which is written in PHP. Should I call it directly as a CGI program? Would it work to invoke it as a system() call from PHP? The latter would be more convenient for me, but I don't know if would be a performance hit.
I'm running Apache 2.x. Thanks for any advice.
5 Replies
James
Guess I'll roll up my sleeves and try to build this thing. Any tips from those who have done this before?
@Xan:
Doesn't mod_php would give you the benefits of pre-compilation? That would surely be the easiest.
Perhaps easiest, but you'd still be writing the algorithm in a highly-abstracted (slow) language. Much faster to do it in C.