Generic bridge between C++ and PHP

We have a web application (quite a heavy-weight one) that does a whole bundle of stuff, web ui, mathematical processing and modelling, and database-related stuff.

A number of the processes that happen in PHP are quite slow, mostly because PHP sucks for mathematical processing.

In the future, we'd like to break these slow process off, and rewrite them in something faster, probably C++, or maybe Java.

Does anyone know of a generic way to get data in and out of PHP and into another language's environment? I've already considered serialising things into JSON and shovelling them into /dev/shm or a socket, then have the other language listen on a socket, or look at the shared memory location etc.

This kinda thing works fine for native types, but does suck quite hard when you consider that a lot of the stuff that gets passed around are actually class instances and similar objects.

I'm not sure of a sensible solution, but I've been considering Quercus PHP implementation which is pure Java, as well as the PHP/Java bridge.
However, I've been unable to find anything for C++ that would do a similar function. Writing a PHP module is a possibility, but I'm struggling to see how it could be sufficiently generic, and not just a case of rewriting each new (and some old) script into a module, then calling those functions in PHP.

5
задан user151019 30 May 2012 в 19:13
поделиться