Now let's create a simple CGI script and test it on the web server. Write down the following code and save it within the cgi-bin folder on the web server with extension '.py' or '.cgi'. Set the permission of the file to executable. For this execute the following Fedora command:

Name:  Implementing CGI.jpg
Views: 84
Size:  44.2 KB

Now open up any web browser and type the. This will give output on the web browser as 'This is a test'. Incase SELinux is running on Fedora, disable it for the time being as it can block the CGI script from executing. The 'cgitb' line helps developers to debug, as it helps in displaying well formatted traceback instead or displaying just 'internal server error' or crashing. But avoid using this line in the production environment as it can expose some holes.