Jump to content


Photo

How to config CGI


  • Please log in to reply
7 replies to this topic

#1 angus203

angus203

    Junior Member

  • Member
  • Pip
  • 11 posts

Posted 05 July 2008 - 07:46 AM

#!/usr/bin/perl
print "Content-Type: text/plain", "\n\n";
print "Hello World in Perl", "\n";

http://localhost/cgi-bin/test.cgi
it has Internal Server Error

http://localhost/cgi-bin/
Forbidden
You don't have permission to access /cgi-bin/ on this server.

how to run cgi?

#2 jacob lee

jacob lee

    Junior Member

  • Member
  • Pip
  • 20 posts

Posted 05 July 2008 - 08:21 AM

internal server error shows you have a problem with your apache configuration file(httpd.conf).

the original uniform server has no problem running your code.

open your httpd.conf(/udrive/usr/local/apache2/conf/httpd.conf) and check your cgi-bin configuration.
it should much like

ScriptAlias /cgi-bin "/cgi-bin/"

# "C:/Program Files/Apache Group/Apache2/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.

<Directory "/cgi-bin/">
  AllowOverride All
  Options ExecCGI
</Directory>

BUT if you have no problem with your first page of uniform server and can shutdown your server using your admin panel page then there might be another problem. check your apache log file also.

#3 angus203

angus203

    Junior Member

  • Member
  • Pip
  • 11 posts

Posted 05 July 2008 - 08:00 PM

this is default setting
ScriptAlias /cgi-bin "/cgi-bin/"

# "C:/Program Files/Apache Group/Apache2/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.

<Directory "/cgi-bin/">
  AllowOverride All
  Options ExecCGI
</Directory>

<Directory "/home/admin/www/cgi-bin/">
  AllowOverride All
  Options ExecCGI
</Directory>

i have deleted the .htaccess file and enabled "AddHandler cgi-script .bat .exe .pl .cgi"
finally no work...
what problem?

#4 Ric

Ric

    Project Manager

  • Admin
  • PipPipPipPipPip
  • 1,535 posts
  • Gender:Male
  • Location:Cambridge,UK
  • Interests:Electronics
    Internet in general
    Open source projects
  • SourceForge IDmpgcan
  • Wiki ID: Ric
  • Main OS: Windows XP

Posted 06 July 2008 - 05:34 AM

I deleted my last post answered the wrong question. :)

Deleting .htaccess prevents running CGI scripts in www and its sub-folders.

Any scripts in cgi-bin will run with the defaults you have shown.

It would be interesting to see if the error log file provides a clue to the problem.
Before running the servers open error.log located in \Uniform Server\udrive\usr\local\apache2\logs delete it’s content. Save and run the servers, access your script. Now check the log file for errors.

What do you get?

All the best
Ric :)

#5 angus203

angus203

    Junior Member

  • Member
  • Pip
  • 11 posts

Posted 06 July 2008 - 10:37 PM

I deleted my last post answered the wrong question. :)

Deleting .htaccess prevents running CGI scripts in www and its sub-folders.

Any scripts in cgi-bin will run with the defaults you have shown.

It would be interesting to see if the error log file provides a clue to the problem.
Before running the servers open error.log located in \Uniform Server\udrive\usr\local\apache2\logs delete itís content. Save and run the servers, access your script. Now check the log file for errors.

What do you get?

All the best
Ric :)


Error log
[Sun Jul 06 08:55:49 2008] [error] [client 127.0.0.1] attempt to invoke directory as script: W:/cgi-bin/
[Sun Jul 06 08:55:54 2008] [error] [client 127.0.0.1] script not found or unable to stat: W:/cgi-bin/index.cgi


#6 jacob lee

jacob lee

    Junior Member

  • Member
  • Pip
  • 20 posts

Posted 07 July 2008 - 10:07 PM

what is need is error logs when the url is http://localhost/cgi-bin/test.cgi
not http://localhost/cgi-bin/

#7 angus203

angus203

    Junior Member

  • Member
  • Pip
  • 11 posts

Posted 08 July 2008 - 07:10 PM

what is need is error logs when the url is http://localhost/cgi-bin/test.cgi
not http://localhost/cgi-bin/



http://localhost/cgi-bin/test.cgi
[Sun Jul 08 08:55:54 2008] [error] [client 127.0.0.1] script not found or unable to stat: W:/cgi-bin/test.cgi


#8 jacob lee

jacob lee

    Junior Member

  • Member
  • Pip
  • 20 posts

Posted 08 July 2008 - 08:06 PM

does test.cgi exist in "/udrive/cgi-bin" folder? the error log says you do not have the script file in "/udrive/cgi-bin" folder.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users