Running and Testing the CGI Script

Once the file creation and code insertion process is been done, then our next task is to configure the web server and run the application/examples on the web server. So follow the below steps to run the example on the XAMPP Server.

Step 1: First, we need to launch the XAMPP Control Panel from the start menu. Make sure to run it as an administrator to have full control.

Step 2: After opening, we need to click on the Config of the Apache module to edit the configuration file.

Step 3: After clicking on the option, we need to select the file as Apache (httpd.conf) and click on it.

Step 4: Once the file gets opened, we need to find the line as ScriptAlias /cgi-bin/ “C:/xampp/cgi-bin/” and uncomment it from the config file.

Step 5: We need to save the file once the changes are been done and need to restart the Apache Web Server.

Step 6: Now, we can access the script through a web browser by navigating to “http://localhost/index.html” in our web browser.

In the below output, we can see that, as we are entering the data in the index.html form, once the Submit button is been clicked, the data is sent to the formhandler.cgi script file. We are simply displaying the received data here.

Output



How CGI Scripts recieve data from HTML forms?

In this article, we will see how we can revive the data from HTML forms in CGI Scripts (Common Gateway Interface). We will perform the demonstration on a Windows Operating System machine. We will create a basic HTML form and a CGI script using Python, which will handle the data revived from the HTML form.

Related Concepts

  • CGI Script: A CGI script is nothing but a program that is executed on the web server and can also generate dynamic web content. We can use this to make the web application form, server-side content, etc.
  • Web Server: A web Server is an important utility in which the information requests and responses to the request are done properly, To run the CGI scripts, the Web Server is required.
  • HTTP: Hypertext Transfer Protocol is the foundation of data communication on the World Wide Web. It defines how messages are formatted and transmitted.
  • HTML: Hyper-Text Markup Language is used to create the web pages that are displayed in the web browser. Different elements like Buttons, Text Fields, etc can be created using this language.

Prerequisites

Similar Reads

Creating CGI Script to Recieve Data from HTML Forms

To receive the data from the HTML Forms and handle or display it in the CGI script, we need to follow the below-added steps with proper file creation....

Running and Testing the CGI Script

...

Contact Us