954,525 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

cgi

im new to cgi scripting...im using python...and ubuntu...
i changed apache2's default file to set the cgi directory to /var/www/cgi-bin...and there i i uploaded my simple cgi file...the cgi file runs perfectly fine when run through terminal...which means there is no error...but when i try to access it through a web browser i get "You don't have permission to access /cgi-bin/ on this server."
/var/www is my localost directory...and i pass http://localhost/cgi-bin/index.cgi as the address...
i have also checked my permissions ... they're all fine...
every file is readable as well as executable by all users...

#!/usr/bin/env python
print """Content-type: text/html
<TITLE>CGI 101</TITLE>
<H1>A Third CGI script</H1>
<HR>
<P>Hello, CGI World!</P>
<table border=1>
"""
for i in range(5):
    print "<tr>"
    for j in range(4):
        print "<td>%d.%d</td>" % (i, j)
    print "</tr>"
print """
</table>
<HR>
"""

can you please temme where im going wrong...

dos_killer
Junior Poster in Training
50 posts since Dec 2010
Reputation Points: 15
Solved Threads: 4
 

You must chmod cgi scripts to 0755. Cgi's only works with that permission. ok?

:)

richieking
Master Poster
764 posts since Jun 2009
Reputation Points: 61
Solved Threads: 152
 

folder permission is 777 ( for cgi-bin ) and file permissiong is 755
i set these permissions for testing...
they didnt work .. !

dos_killer
Junior Poster in Training
50 posts since Dec 2010
Reputation Points: 15
Solved Threads: 4
 

post the error code please

richieking
Master Poster
764 posts since Jun 2009
Reputation Points: 61
Solved Threads: 152
 

Forbidden

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

Apache/2.2.14 (Ubuntu) Server at localhost Port 80

dos_killer
Junior Poster in Training
50 posts since Dec 2010
Reputation Points: 15
Solved Threads: 4
 

Are you sure the cgi diractory is configured well?
what is the owner and user group,...?

1.Its apache the owner of this directory??
2. Can you access a different cgi script from the dir.
3. Have you configured apahce conf well?

richieking
Master Poster
764 posts since Jun 2009
Reputation Points: 61
Solved Threads: 152
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: