im new to cgi 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
<H1>A Third CGI script</H1>
<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 """

can you please temme where im going wrong...

Recommended Answers

All 5 Replies

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


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

post the error code please


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

Apache/2.2.14 (Ubuntu) Server at localhost Port 80

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?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.