To execute perl scripts using apache2 in cgi-bin.
step 1#cp /etc/apache2/mods-available/cgi* /etc/apache2/mods-enabled/.
step 2#vi /etc/apache2/sites-available/default
ScriptAlias /cgi-bin/ /var/www/cgi-bin/
< Directory "/var/www/cgi-bin/" >
AllowOverride None
Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
< /Directory >
step 3#/etc/init.d/apache2 restart
step 4#vi hello.pl
add following line into file hello.pl
-------------------------
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "< html > < head > \n";
print "< title > Hello, world! < /title > < /head > \n";
print "< body bgcolor=\"#FFFFFF\" text=\"#000000\" link=\"#FF0000\" vlink=\"#8000
00\" > \n";
print "< h1 > Hello, PERL world! < /h1 > \n";
print "< a href=\"../perl/tutorial.html\" > < b > Back </b > < /a > to the Tutorial\n";
print "< /body > < /html > \n";
step 5#cp hello.pl /var/www/cgi-bin/.
step 6#http://localhost/cgi-bin/hello.pl
step 7#for error do check into /var/log/apache/error.log
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment