[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [1/8OT] How to open .cgi



On 03/07/2012 08:53 PM, lina wrote:
I don't know how to run .cgi in debian (or iceweasle)

Start here:

    http://wiki.debian.org/Apache


To install Apache, run the following command (as root):

    # apt-get install apache2


The file system location for CGI scripts is set in the Apache default site configuration file:

    # grep -r cgi-bin /etc/apache2/sites-available/default
	    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
	    <Directory "/usr/lib/cgi-bin">


Place a script into the /usr/lib/cgi-bin directory:

    # vi /usr/lib/cgi-bin/hello.pl

    # cat /usr/lib/cgi-bin/hello.pl
    #!/usr/bin/perl
    use strict;
    use warnings;
    print "Content-Type: text/plain\n\nhello, world!";
    exit 0;


Make it executable:

    # chmod +x /usr/lib/cgi-bin/hello.pl


Check the syntax:

    # perl -c /usr/lib/cgi-bin/hello.pl
    /usr/lib/cgi-bin/hello.pl syntax OK


Run the script in your shell:

    # perl /usr/lib/cgi-bin/hello.pl
    Content-Type: text/plain

    hello, world!


Browse the script:

    http://localhost/cgi-bin/hello.pl

    hello, world!


HTH,

David


Reply to: