CGI : Make it work in the default directory

June 18, 2016 · 1 mins read
Categories: BaKaplan   | cgi   | Six weeks training |

Hello everyone,

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

cd /var/www/apache2/html/
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.

https://amisha2016.wordpress.com/2016/02/18/task-2/

https://iamjagjeetubhi.wordpress.com/2016/06/03/cgi-in-c/

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.

Please share your Feedback:

Did you enjoy reading or think it can be improved? Don’t forget to leave your thoughts in the comments section below! If you liked this article, please share it with your friends, and read a few more!

We don't share your details with others