in reply to CGI SCRIPT ITSELF IS DISPLAYED

See https://httpd.apache.org/docs/2.2/howto/public_html.html#cgi / Apache Tutorial: Dynamic Content with CGI and more

Copy/paste from Re: To call a .pl file when a button is pressed on a GUI created using Perl CGI (webserver) for the links below

Its simple, you need a webserver

Why? Because webpages and CGI needs a webserver, thats how it works

Its weird that so many folks manage to create a GUI using Perl CGI without understanding this

learn about the internet,Web Programming: For Beginners, to get an overall picture of how the internet works, how tcp/ip, sockets, html, ajax, all fit together....

See also Mojolicious::Lite +and jQuery +AJAX + Mojo::Template

And a copy-pasta for you:)

Also, there are checklists for that , Basic debugging checklist , brian's Guide to Solving Any Perl Problem, CGI Help Guide , Troubleshooting Perl CGI scripts

Yes, work through these checklists, when you find a problem on the list, use a solution from the list, when you find a problem not on the list (rare), post the error message and problem description here

brian's Guide to Solving Any Perl Problem, CGI Help Guide , Troubleshooting Perl CGI scripts

So examine your server configuration and compare to https://httpd.apache.org/docs/2.2/howto/public_html.html#cgi / Apache Tutorial: Dynamic Content with CGI

learn about the internet,Web Programming: For Beginners, to get an overall picture of how the internet works, how tcp/ip, sockets, html, ajax, all fit together.

Explicitly using Options to permit CGI execution, Apache Tutorial: Dynamic Content with CGI - Apache HTTP Server Version 2.2 : Explicitly using Options to permit CGI execution

Replies are listed 'Best First'.
Re^2: CGI SCRIPT ITSELF IS DISPLAYED
by Anonymous Monk on Sep 26, 2014 at 07:52 UTC
    Thanks for the suggestion..!! I managed to run the cgi script on my server by configuring the file (1./etc/apache2/sites-enabled/000-default.conf 2./etc/apache2/apache2.conf) . However, still am not able to generate a figure. Instead, a blank layout is shown.I know that it is something related to file pointing the figure.Kindly suggest me. anikng

    Some information, My html file is in var/www/html folder. CGI script is under usr/lib/cgi-bin (i use this path to the configuration file for cgi configuration).

    <!DOCTYPE html> <html> <body> <h3> <center>TRANSCRIPTION FACTOR FAMILY</center></h3> <form action="http://localhost/cgi-bin/test.cgi" method="GET"> <input type="submit" value="NAC"> </form> </body> </html>
    #!/usr/bin/perl use CGI; use CGI::Carp qw(fatalsToBrowser warningsToBrowser); $q=new CGI; print "Content-type: text/html\n\n"; @field=$q->param(); $name=$q->param("value"); print<<"OUTPUT"; <html> <head> <title>TRANSCRIPTION FACTOR DATABASE </title> </head> <body> <img src="file:///var/www/html/index.jpeg" height="42 +0" width="420"> <br><br><br><br><br> <center><table border=0> <tr><td> </td></tr> </table></center> </body> </html> OUTPUT
      <img src="file:///var/www/html/index.jpeg" height="420" width="420">

      That's not how HTTP works with HTML. Every resource generates its own HTTP request. You will need to serve the image via HTTP too, instead of using the file:// protocol.

      You will need to use a file path that is relative to your CGI script. Maybe

      <img src="index.jpeg" height="420" width="420">

      already is enough, because the image lives in the same folder as your HTML page.

      This has very little to do with Perl. I recommend you try it out with a static HTML page and a static image file first.

      However, still am not able to generate a figure. Instead, a blank layout is shown.I know that it is something related to file pointing the figure.Kindly suggest me. anikng

      Go back and read more about urls, file:... is not http://localhost