OK. So, let’s take PHP as an example.
- I’m entering a URL in the browser, requesting a php script. (e.g.
http://www.somedomain.com/index.php) - The browser sends that request to the appropriate server.
- The server recognizes – by its extension (
.php) – that’s it’s a PHP
file. - The PHP interpreter processes the file and outputs the results.
- The server sends back the output.
Now, let’s say we are dealing with a… home-made interpreter XYZ (with its binary,etc), dealing e.g. with .xyz files.
How should I go about that, so all the above things are valid for my XYZ interpreter?
How should I set this whole thing up, so that it works properly?
Hint : I’m not requesting help on how to write an interpreter, but on how to make it function the above way…
This totally depends on what web server you are using. However, if that is Apache, you should look into
apxsfor building and installing your own apache modules. Google will help you find online tutorials onapxs.For adding a handler for a specific file ending, you should do something like this in your apache configuration (after your iterpreter/apache module is built):