Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

cgi-bin server error

by oaklander (Acolyte)
on Feb 13, 2002 at 16:04 UTC ( #145187=perlquestion: print w/replies, xml ) Need Help??

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

I have a CGI script that works locally but wont work on the server. It is a survey to find out information and store it in a text file. The results are then displayed after user enters info. My problem is I keep getting error message:
The specified CGI application misbehaved by not returning a complete s +et of HTTP headers. The headers it did return are: Can Not open //webserver/directory/stats.txt: Permission denied
I have full permissions on this file and on the directory (according to the server administrator). I have tried putting the text file in another directory (away from my cgi-bin as seen in the error message I posted) but still get same error message no matter where I put it. Anyone have any suggestions or had this problem before?

Replies are listed 'Best First'.
Re: cgi-bin server error
by slayven (Pilgrim) on Feb 13, 2002 at 16:17 UTC
    I have full permissions on this file and on the directory

    Depending on the configuration of the webserver your script may be executed with the rights of the webserver, not yours.

    --
    trust in bash
    but tie your camel
      So I need to advise the server admin to give me what permissions?? I can make my scripts work if I just use a form and script (.pl) but if I get a text file involved I get the permissions error.
        As rjray mentioned, the webserver usually runs as user nobody, so all the cgi-script run as if they were executed by this user. If you need to open a file within a cgi-script, the file has to be readable by nobody.

        You should also consider that files created by the cgi-script are owned by nobody with the permissions depending on his umask.

        Note that these are some default configuration options. It's possible that the cgi-scripts are executed with the permissions and rights of the script-owner. Ask your admin about the webserver configuration and try to find a secure solution for your problem. The easiest way would be to change the file permissions to world-readable (chmod 666 <file>) which means that everyone may read the file who has access to the server - not a secure solution for sensible data ...

        --
        trust in bash
        but tie your camel
Re: cgi-bin server error
by rjray (Chaplain) on Feb 13, 2002 at 23:00 UTC

    You need to check with the server administrator and find out what user and group IDs the server runs as. Many "factory-installed" (that is, comes with the O/S as with SuSE, Red Hat, etc.) servers run as user "nobody" and a group by the same name. Thus, the file needs to be readable by these users.

    --rjray

      This is on a NT server. It seems to be rejecting me at the Directory level.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://145187]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2023-12-10 23:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?











    Results (41 votes). Check out past polls.

    Notices?