I have a guestbook.htm file in the directory named as Chrome (/home/chankey/Desktop/Chrome/guestbook.htm) whose content is given below
<html>
<head>
<title>Guestbook</title>
</head>
<body>
<form action="/home/chankey/Desktop/Chrome/guestbook.pl" method="get">
<table>
<tr><td>Name</td><td><input name="name" type="text" value=""></td></tr>
<tr><td>E-Mail</td><td><input name="email" type="text" value=""></td></tr>
<tr><td>Location</td><td><input name="loc" type="text" value=""></td></tr>
<tr><td>Comments</td><td>
<TEXTAREA name="comments" rows="10" cols="32"></TEXTAREA></td></tr>
</table><br><br>
<input type="submit" value="Add Entry">
</form>
</body>
</html>
In the same Chrome directory I have one file "guestbook.pl" whose content is
#!/usr/bin/perl
my $query_string = "";
#Get the input
if ($ENV{REQUEST_METHOD} eq 'POST') {
read(STDIN, $query_string, $ENV{CONTENT_LENGTH});
} else {
$query_string = $ENV{QUERY_STRING};
}
##### We will remove this
print "Content-Type: text/html\n\n";
print "Query String is \n<br> $query_string";
##### We will remove this
When I am executing the guestbook.htm file there appears a form, when I fill the data and click on "Add Entry" button a new page opens where the complete script appears.
i.e. the script "guestbook.pl" is not executing. May I know the reason behind this? Why the script is not executing? (I have already given executing permission to this file).
In the httpd.conf file I have added
AddHandler cgi-script cgi pl
<Directory /home/chankey/Desktop/Chrome/>
Options +ExecCGI
</Directory>
Still it is not executing. Let me know the reason.
When you access a file locally (over the file:// type URL in your browser), it's not running from a web server, so:
httpd.conf/.htaccess files have no effectA few ways to deal with this:
public_html in your home. Your web server likely has a setting to map http://localhost/~chankey/ to /home/chankey/public_html. (On MacOSX, the preferred name is Sites, instead, I believe.) On an SELinux system, you'll have to specifically grant permission for Apache to use this method.CGI package, you can also run them manually from a terminal shell, and redirect their output to a temporary file (e.g. >/tmp/output.html), which you can then access/var/www/html/…PS / unrelated: I strongly recommend that, if you plan to put this on the Internet, you should probably use CGI; use strict; and have the tainting mode enabled #!/usr/bin/perl -WT …
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With