Debian 7.0
Sponsored Link

Use Perl Script2013/05/11

 
Enable CGI executing and use perl script.
[1] Install Perl
root@www:~#
aptitude -y install perl
[2] Configure Apache2 to use CGI in any directory
root@www:~#
vi /etc/apache2/mods-enabled/dir.conf
# line 3: add file name that it can access only with directory's name

DirectoryIndex index.html
index.cgi
root@www:~#
vi /etc/apache2/mods-enabled/mime.conf
# line 219: uncomment and add extensions for CGI

AddHandler cgi-script
.cgi .pl
root@www:~#
vi /etc/apache2/sites-available/default
# line 10: change ( remove "Indexes" )

Options FollowSymLinks MultiViews
ExecCGI
root@www:~#
/etc/init.d/apache2 restart

Restarting web server: apache2 ... waiting .
[3] Create a CGI test page and access to it with web browser. It's OK if following page is shown.
root@www:~#
vi /var/www/index.cgi
#!/usr/bin/perl

print "Content-type: text/html\n\n";
print "<html>\n<body>\n";
print "<div style=\"width: 100%; font-size: 40px; font-weight: bold; text-align: center;\">\n";
print "CGI Test Page";
print "\n</div>\n";
print "</body>\n</html>\n";

root@www:~#
chmod 705 /var/www/index.cgi

Matched Content