-2

I would like to run perl as CGI . i.e Want to run it in localhost rather than command prompt.

I have installed perl . I have kept my file at /var/www/cgi-bin/

and i have made following changes in /etc/apache2/apche2.conf

    ScriptAlias /cgi-bin/ /var/www/cgi-bin/

    <Directory /var/www/cgi-bin/>
     Options ExecCGI
     AddHandler cgi-script cgi pl
    </Directory>

Its giving me 404 not found error.

Following is the url I am accessing:

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

  • 1
    What's `/home` in your `ScriptAlias` ? – F. Hauri - Give Up GitHub Oct 28 '15 at 07:04
  • I've voted to re-open this question. It's not a duplicate (or, at least, not a duplicate of the the question that it was marked as a duplicate of). That was brian's excellent question about debugging CGI programs. This isn't a problem with a CGI program, it's a problem with web server configuration. Of course, it might be off-topic for StackOverflow. – Dave Cross Oct 28 '15 at 14:46

1 Answers1

0

If your file is at /var/www/cgi-bin/, and your configuration says:

ScriptAlias /cgi-bin/ /home/www/cgi-bin/

Then I'd say that the problem is pretty obvious. /var/www/cgi-bin/ and /home/www/cgi-bin/ are not the same directory.

Update: Ok. So you say that you have fixed the value of ScriptAlias and it still didn't work. Assuming that you're still getting the 404 error, then the next obvious step is to look in your error log and see exactly which file Apache is looking for. There's probably a mismatch between how Apache is configures to map between URLs and files and how you think it is configured.

When you get that error message, add it to your question.

Dave Cross
  • 68,119
  • 3
  • 51
  • 97
  • Thanks dave...!!! I have made changes to my question I have made changes to scriptAlias ( it was wrongly copied as "home) .. But didn't got any helpful results. Thanks – Siddeshwar Vanga Oct 29 '15 at 05:12