Search code examples
apachecgiapplication-server

How to begin writing an Application Server over Apache?


For my college project, I want to create a simple application server in C that runs over Apache. Like .php, .asp, .jsp, the extension of my files would be .sas.

I have already written a parser which reads the .sas files and generates the output. For example, consider a file index.sas with the below code:

<%   
echo "Hello";  
%>  

Now, if I execute:

sas index.sas

The result would be:

Hello

Now I want to use this program as an application server over Apache just as PHP, Tomcat, etc. work over Apache. I have heard of cgi-bin but I think PHP uses a different approach. I want to learn the approach which PHP uses.

Please advice.


Solution

  • Little correction: Apache HTTP Server is not required to be able to run Apache Tomcat as webserver. Apache Tomcat is at its own already a full fledged webserver. Your confusion is probably caused by the Tomcat Connector which could be used to connect Apache HTTP Server and Apache Tomcat together to be able to serve PHP/JSP behind one same HTTP port.

    As to your actual question, PHP can be installed as CGI module or ASAPI (Apache Server API) module. If you want to program a CGI module for Apache HTTP Server, then you may find this document useful. If you want to write an ASAPI module, then you may find those documentations useful.