I'm working on a project that involves a database (My SQL), website (PHP) and a custom high performance server application (C++). The C++ application (and its accompanying client application) make up the main bulk of the project, with the database storing long term data for it. The website is primarily for displaying various statistics, and administration.
1) I want the PHP scripts and c++ application to be able to communicate in some way, since the database is only used for persistent data, and additionally the c++ application may cache some things so needs to be told to reload the data in some cases. It is highly likely they will be on different machines, and even possibly different OS's. I've been considering the idea that TCP may be the best option with some simple command - response protocol?
2) What is the best way to write the common database interface code once, and be able to use it from both the PHP website and the c++ applications?