Home: Perl Programming Help: Beginner:
spawning perl script from web page



perl_man
Novice

Aug 4, 2016, 4:42 PM


Views: 2124
spawning perl script from web page

hi
I'm having trouble executing a perl script on a remote server from a web page

here's the code inside the f0.cgi script

<<<<
#!/usr/bin/perl
use warnings;
use strict;
use diagnostics;
use CGI;

print "Content-type: text/html\n\n";

print <<EOF;
<html>
<head><title>Title</title></head>
<body>
EOF

my $out = `ls`;
print "<pre>$out</pre>";

print <<EOF;
</body>
</html>
EOF
exit;
>>>>

when clicking on the link I get the content of the script;not the directory listing as it is supposed to do
with the `ls` backtick command.

I'v chmod u+x f0.cgi
and chmod o+x f0.cgi

dir directory containing f0.cgi is also chmod

where did I go wrong ?
Frown


Zhris
Enthusiast

Aug 5, 2016, 8:15 AM


Views: 2111
Re: [perl_man] spawning perl script from web page

Is your server configured properly to permit CGI?

http://httpd.apache.org/docs/current/howto/cgi.html

Chris


(This post was edited by Zhris on Aug 5, 2016, 8:16 AM)