Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

4.4 Common gateway interface.md 2.0KB

So far you have

  • setup XAMPP
  • read up on
    1. Web servers, browsers,
    2. the HTTP
    3. and URIs

Now we are at the point where programming comes into play - a web browser loading a “web app”, a program, if you will.

Remember how we went over programs (in document 1.1) and applications (in document 1.3)? This is now transferrable to web apps. If you re-visit 1.3 you will find documented very basic usage of the “dir” program, whose purpose is to list out state of the filesystem (see documents 3.1, 3.2) at location which it is invoked from.

Well, this same functionality can be turned into a web app, an HTTP networked program. You could, if you wanted to, tell Apache (in your XAMPP installation) to run “dir” every time it gets an HTTP request.

You could, if you wanted to, write a C++ “hello world” program

#include <iostream>

int main()
        std::cout << "Hello world!";
        return 0;

then point your XAMPP apache to the compiled binary/runtime so once you load http://localhost in a browser you will see a page saying “Hello world!”. Now you get how web development basically works: write a program/script, then point a web server to get said program’s output.


CGI script setup

To elaborate more on the “then point your XAMPP apache to XYZ” part, if you get variability and how programs/functions work in general (see documents 1.4, 1.5), you will understand that what happens at server run-time is that the




directory (whichever one you are operating on (depending on the OS)) is basically a parameter, instructing the server program to ask the filesystem for data stored in that directory. In our previous case it was an index.html file within /var/www/html (or the other one), for the rest of this project and as we are dealing with PHP, the data that we are initially giving the web server will be an index.php script/file - instructing the server to pass the script/file contents to a PHP-interpreting program (usually php-fpm (on older setups php-cgi)).