manishrathi has asked for the wisdom of the Perl Monks concerning the following question:

I have apache2.2 installed on my computer. when I type url as "http://localhost/cgi-in/printenv" , it does not display result. I get HTTP 400 , webpage not found error. In the scriptAlias parameter of the conf file, the route is specified properly. Apache server is runing, I tried using printenv.pl, but still same result.

Please guide me to see whats wrong in here

Replies are listed 'Best First'.
Re: printenv not displaying results
by zwon (Abbot) on Jan 11, 2010 at 23:43 UTC

    If your script is called printenv.pl, then perhaps URL should be http://localhost/cgi-bin/printenv.pl ?

    Update: Also HTTP 400 is a Bad Request, Page Not Found is 404. What error are you getting?

      1 I tried using http://localhost/cgi-bin/printenv.pl, but I get the same result 'page not found' http 400. I tried using localhost:80 also.

      2 yes, I am getting 'page not found' error and there is http 400 besides it

      oh vow, its running now. when I typed http://localhost/cgi-bin/printenv.pl, it did run and asked me to run or save the printenv file. When I clicked on run, it just run but did not display any output on console. Why is that ? second time, I saved output on desktop and I can see printenv file on the desktop (without any .pl extension). when I click on this file, it just runs and does not open. When I open with notepad, then I can see the output. why is that ? why is there no extension on the output file ? There is no extension on the file in cgi-bin dir also. Its there as printenv. How does perl interpreter understand that this is perl file without .pl extension ? If I have pHp interpreter also set in the environment variable path, which ijnterpreter will execute this printenv file, which does not have an extension ?
        An executable script starts with a call to the interpreter to be used, in this case something akin to
        #!/usr/bin/perl
        This is the interpreter used to run the script.

        print "Good ",qw(night morning afternoon evening)[(localtime)[2]/6]," fellow monks."
        How does perl interpreter understand that this is perl file without .pl extension ?

        You're dealing with Apache, Apache decides what to call, how, and when.