How to run CGI script in web browser?

4.3k Views Asked by At

I am setting up environment for CGI script. For that I am following this link: http://help.cs.umn.edu/web/cgi-tutorial

I have written sample CGI script in my Ubuntu environment which is hosted in other server. I am connecting this server using PuTTY. I have successfully given permission to script file and directory. Now to test it, as mentioned in above link.

Below is the code of CGI script i have used:

#!/usr/bin/perl -w

use CGI;

$cgi = new CGI();

print $cgi->header();

print '<?xml version="1.0" encoding="UTF-8"?>';

print '<!DOCTYPE html>
<html>
   <head>

        <title>Perl CGI test</title>
   </head>
  <body>';

print '
      <p>
         Hello world!
      </p>';


print '
   </body>

</html>
';

I am opening http://www-users.cselabs.umn.edu/~ <your_username>/test-cgi.cgi in my own system in Chrome and Firefox browsers.

Below error is displayed:

Object not found!

The requested URL was not found on this server. If you entered the URL  manually please check your spelling and try again.

If you think this is a server error, please contact the webmaster.
Error 404
www-users.cselabs.umn.edu
Thu Jun 11 01:56:35 2015
Apache.

How should I execute it successfully?

Note: CGI script is written on server which is accessed by PuTTY and WinSCP. And I am opening test URL on my own system i.e. windows in Chrome and Firefox.

0

There are 0 best solutions below