If we want to make CGI work, we first must know that why is it used.
To know about the prerequisites read this post.
CGI stands for Common Gateway Interface. CGI help you to compiled program output through the browser window. If we don’t have any tool to show the output of the program on the browser then output file(obj file in the case of C program) will be downloaded. Also CGI is not only used in the case of C or C++ but it can be for many other languages.
Also before going further into the topic I want to discuss some more about how the apache2 server works. This server recognizes a directory as its default working directory and shows out any html page in this directory which have read permissions to others. As when working with the browser we are working as others. This command can be used to open up the folder that folder of the server. Just add a file
Now if we want to show the output of the file on the browser through localhost then we must put the output file here or we must tell that the files in the next other directory must be treated as such to show the result in the browser.
So the procedure for this is explained on two of my friend’s blogs. Please check these both procedures as both of them show different ways in which CGI can be configured in the default directory.
There might be some mistakes in both of the posts. If you find any, then you must comment it in the there respected blogs.
Still need help please comment below.