in reply to Re: creating a file with a cgi script
in thread creating a file with a cgi script

Hi davorg,
Following your advice I tried this
my $OUTFILE_file_name = "../user_log/".$req_id."\.txt"; open ( OUTFILE, '>', $OUTFILE_file_name ) or die "$0 : failed to open output file $OUTFILE_file_name : $ +!\n"; print OUTFILE $uemail; close ( OUTFILE ); # close output file
But it still doesn't get printed in user_log/
And I also get this message
failed to open output file ../user_log/22410.txt : Permission denied
What's wrong with it?

Replies are listed 'Best First'.
Re^3: creating a file with a cgi script
by davorg (Chancellor) on May 19, 2006 at 08:21 UTC

    As I said before, your web server process doesn't have permission to write to that directory. The error message seems pretty clear to me, but if you want more detail then try adding "use diagnostics" to your program.

    Which user does your web server run as? Do you use suexec at at? What are the permissions on the directory that you are trying to write to?

    --
    <http://dave.org.uk>

    "The first rule of Perl club is you do not talk about Perl club."
    -- Chip Salzenberg

      I'm not an SU. And the permission looks like:
      drwxr-xrw- 2 myname myname 4096 May 19 15:28 user_log

        You missed my first question "which user does your web server run as?" And you seem confused by my second question - suexec is an Apache feature.

        --
        <http://dave.org.uk>

        "The first rule of Perl club is you do not talk about Perl club."
        -- Chip Salzenberg

Re^3: creating a file with a cgi script
by izut (Chaplain) on May 19, 2006 at 09:18 UTC

    You're trying to write in your ${HOME}, but as apache is running as a specific user (www or apache), it can't perform the operation, as it doesn't have the proper permissions for doing that.

    Igor 'izut' Sutton
    your code, your rules.