Total Pageviews

Tuesday, October 5, 2010

Enabling Cgi Script

Open /usr/local/apache/conf/httpd.conf

Change <Directory /usr/local/apache/cgi-bin> to

your home directory for eg:
<Directory /home/user/public_html/cgi-bin>
then give AllowOverride All
               Options +ExecCGI

</Directory>


AddHandler cgi-script .cgi .pl


ScriptAlias /cgi-bin/ "/home/user/public_html/cgi-bin/"

Done with the conf file..

Then in ur public_html folder create cgi-bin folder. Inside it create index.pl file.

                  #!/usr/bin/perl -w
                  print "Content-type: text/html\n\n";
                  print "Hello, world";





complie the perl script using command -   perl -wc index.pl
Check if that is running -- perl -w index.pl



Give 755 permission and change group and ownnership as user's.




Take in browser http://ip/cgi-bin/index.pl

No comments:

Post a Comment