Let me convert a PHP means to fix a C++ solution. Presently I've my server-side designed in PHP - little code, within 1000 lines. In order to rewrite it quickly and easily - I don't have to use stylish-hop or similar automations.

Now you ask , how do you install/configure the right software to aid C++ code around the server side. I don't understand how to invoke binaries through the web server via CGI.

PHP is simple, install XAMPP or similar write the PHP and you're simply virtually up on and on.

However, I wish to run C++.


Three fundamental options:

  • perform the whole factor in C++, making your program a stand alone web server (possibly proxying through apache to supply such things as ssl, static media, authentication etc.)
  • run C++ inside a cgi-bin, through apache
  • create a PHP wrapper that shells to the C++ part (this can be a good option when the performance-critical part is small, as possible still make use of the comfort that PHP's garbage collection and string manipulation provides you with)

You are able to invoke your C++ binaries through the Common Gateway Interface that is specified by RFC 3875.

Each webserver that supports CGI (and extremely common) may then invoke your binaries. Just in case you are using apache 3.1 for performance and stablility reasons, there is a section within the manual: Dynamic Content with CGI.

Cgi and c++ code good examples are often to become situated with an search on the internet, so this is just one example.

Whenever you got this to operate and also got accustomed to it, you are able to consider going one step ahead and migrate to FastCGI. It reduces the expense of forking a procedure every time as CGI does. An alternative choice is you make your script in type of an apache module and directly serve from inside httpd.