Forum Moderators: phranque

Message Too Old, No Replies

can't run cgi-bin programs as user?

         

shams

11:51 am on Oct 30, 2006 (gmt 0)

10+ Year Member



hi,
i am loging as user to my pc runing fc5, i wrote a cgi script as root from a terminal using su in the /var/www/cgi-bin and i made it executable with chmod u+x, now when i want to execute this script from the cgi-bin as [localhost...] this is the error:
Forbidden
You don't have permission to access /first.pl on this server.
after this error i changed the ownership of cgi-bin and the script to my user name but even after that this is the error message, the serve runing apche. and this is the apache error log;
[Mon Oct 30 16:56:16 2006] [error] [client 127.0.0.1] Premature end of script headers: first.pl
[Mon Oct 30 16:59:56 2006] [error] [client 127.0.0.1] Options ExecCGI is off in this directory: /var/www/html/first.pl
and this is the script:
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "Hello, World.";
any one can help please?

jdMorgan

2:34 pm on Oct 30, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The error log is telling you what to do.

Add the directive:


Options +ExecCGI

to an .htaccess file in the script subdirectory. Or alternatively, define a <Directory> container for that subdirectory in your httpd.conf file, and put the Options directive in it.

Take a look at the Options directive and the <Directory> container write-ups in the Apache core [httpd.apache.org] documentation, so you can identify the best solution for your needs.

Jim

shams

3:22 pm on Oct 30, 2006 (gmt 0)

10+ Year Member



thanks for reply, as i mentioned the script is in the /var/www/cgi-bin there was no any .htaccess file i created one as well in /var/www/html with this content:
Options +ExecCGI
as well i added this option to httpd.conf:
<Directory /var/www/cgi-bin>
Options +ExecCGI
</Directory>
restarted the apache server but now got the other error:
Not Found
The requested URL /first.pl was not found on this server.
also the httpd error log now changed to:
[Mon Oct 30 20:29:49 2006] [error] [client 127.0.0.1] script not found or unable to stat: /var/www/html/first.pl