Permission denied with PERL/APACHE

Discussion in 'Perl Misc' started by Nicolas D, May 9, 2004.

  1. Nicolas D

    Nicolas D Guest

    Hello,

    I use a PERLscript lauched by Apache web server,
    with the line
    "open (FICH, '>>commandes.txt') || die " error: :$!";

    i obtain the following line in my error.log:
    "permission denied

    i tried to change the rights but with no results.

    what is the pb ?

    thanks
     
    Nicolas D, May 9, 2004
    #1
    1. Advertising

  2. On 09 May 2004, you wrote in comp.lang.perl.misc:

    > Hello,
    >
    > I use a PERLscript lauched by Apache web server,
    > with the line
    > "open (FICH, '>>commandes.txt') || die " error: :$!";
    >
    > i obtain the following line in my error.log:
    > "permission denied
    >
    > i tried to change the rights but with no results.
    >
    > what is the pb ?


    perldoc -q 500

    http://www.perl.org/troubleshooting_CGI.html

    --
    A. Sinan Unur
    (reverse each component for email address)
     
    A. Sinan Unur, May 9, 2004
    #2
    1. Advertising

  3. In article <>,
    Nicolas D <> wrote:
    :I use a PERLscript lauched by Apache web server,
    :with the line
    :"open (FICH, '>>commandes.txt') || die " error: :$!";

    :i obtain the following line in my error.log:
    :"permission denied

    :i tried to change the rights but with no results.

    :what is the pb ?

    Apache is not necessarily going to be "in" any directory that you
    have write access to. Do not assume that just because your script
    has been invoked, that the current working directory of the
    executing script is anything even close to the location of the
    script itself.

    You should use chdir to change to the directory you need.


    You also should not expect that Apache will be running under your
    account id just because it launched your script. You might be able
    to change the perl variable $> to the effective UID that you
    want, but probably not -- Apache is not likely going to be running
    as root.
    --
    Warhol's Second Law of Usenet: "In the future, everyone will troll
    for 15 minutes."
     
    Walter Roberson, May 9, 2004
    #3
  4. Nicolas D <> wrote:


    > I use a PERLscript lauched by Apache web server,



    What is a "PERLscript"?

    Did you mean "Perl script" or "Perlscript"instead?


    > with the line
    > "open (FICH, '>>commandes.txt') || die " error: :$!";
    >
    > i obtain the following line in my error.log:
    > "permission denied
    >
    > i tried to change the rights but with no results.
    >
    > what is the pb ?

    ^^
    ^^

    What is the Peanut Butter? Your question makes no sense to me...


    Your problem is that you do not have the required permissions, what else?

    You don't tell us what OS you are using, but if it is a *nix-flavor
    one, you may need to change the permisssions on the directory that
    the file is in, rather than the permissions on the file itself...


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
     
    Tad McClellan, May 9, 2004
    #4
  5. Nicolas D

    Nicolas D Guest

    Tad McClellan <> wrote in message news:<>...
    > Nicolas D <> wrote:
    >
    >
    > > I use a PERLscript lauched by Apache web server,

    >
    >
    > What is a "PERLscript"?
    >
    > Did you mean "Perl script" or "Perlscript"instead?
    >
    >
    > > with the line
    > > "open (FICH, '>>commandes.txt') || die " error: :$!";
    > >
    > > i obtain the following line in my error.log:
    > > "permission denied
    > >
    > > i tried to change the rights but with no results.
    > >
    > > what is the pb ?

    > ^^
    > ^^
    >
    > What is the Peanut Butter? Your question makes no sense to me...
    >
    >
    > Your problem is that you do not have the required permissions, what else?
    >
    > You don't tell us what OS you are using, but if it is a *nix-flavor
    > one, you may need to change the permisssions on the directory that
    > the file is in, rather than the permissions on the file itself...


    my OS is mandrake10 with "Apache-AdvancedExtranetServer/2.0.48
    (Mandrake Linux/5mdk) mod_perl/1.99_11 Perl/v5.8.3 Server at 127.0.0.1
    Port 80"

    i write
    "User apache
    Group apache" in httpd2.conf,

    the perl script is ok when i excecute it in the directory, i can write
    in the file, but when i launch it with apache i obtain "permission
    denied" when the script open the file with write access rights,
    i create a login with apache user and apache group but no results,
    i think my problem is that i don't know how configure apache to have
    write rights....so i download the perl and apache documentation and i
    ll read it.
    Excuse for my english wich is as bad as my perl knowledge.
     
    Nicolas D, May 10, 2004
    #5
  6. Nicolas D <> wrote:


    > i think my problem is that i don't know how configure apache



    Then you should be asking in a newsgroup that has something
    to do with configuring web servers.

    comp.lang.perl.misc is not such a newsgroup.

    comp.infosystems.www.servers.unix is though.


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
     
    Tad McClellan, May 10, 2004
    #6
  7. Nicolas D

    gnari Guest

    "Nicolas D" <> wrote in message
    news:...
    > Tad McClellan <> wrote in message

    news:<>...
    > > Nicolas D <> wrote:
    > >
    > >
    > > > with the line
    > > > "open (FICH, '>>commandes.txt') || die " error: :$!";
    > > >

    > >
    > >
    > > Your problem is that you do not have the required permissions, what

    else?
    > >
    > > You don't tell us what OS you are using, but if it is a *nix-flavor
    > > one, you may need to change the permisssions on the directory that
    > > the file is in, rather than the permissions on the file itself...

    >
    > my OS is mandrake10 with "Apache-AdvancedExtranetServer/2.0.48
    > (Mandrake Linux/5mdk) mod_perl/1.99_11 Perl/v5.8.3 Server at 127.0.0.1
    > Port 80"
    >
    > i write
    > "User apache
    > Group apache" in httpd2.conf,
    >
    > the perl script is ok when i excecute it in the directory, i can write
    > in the file, but when i launch it with apache i obtain "permission
    > denied" when the script open the file with write access rights,
    > i create a login with apache user and apache group but no results,
    > i think my problem is that i don't know how configure apache to have
    > write rights....so i download the perl and apache documentation and i
    > ll read it.
    > Excuse for my english wich is as bad as my perl knowledge.


    then make sure to
    a) make sure the writing happens in the directory you
    think it does, by doing a chdir or changing the open to
    my $fullpath='/fullpath/to/dir/commandes.txt';
    open (FICH, ">> $fullpath")
    || die " error: could not open '$fullpath' :$!";
    b) make sure that said directory is owner and/or writable
    by user or group apache

    gnari
     
    gnari, May 11, 2004
    #7
  8. In article <>,
    Nicolas D <> wrote:
    :the perl script is ok when i excecute it in the directory, i can write
    :in the file, but when i launch it with apache i obtain "permission
    :denied" when the script open the file with write access rights,

    Did you follow my advice to check out your $> and to not assume
    that you are in any particular directory? Start by fully-qualifying
    the path to your commands.txt file rather than assuming that you can
    write in the current working directory.
    --
    Strange but true: there are entire WWW pages devoted to listing
    programs designed to obfuscate HTML.
     
    Walter Roberson, May 11, 2004
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Goblin
    Replies:
    1
    Views:
    8,459
  2. The Poor
    Replies:
    2
    Views:
    237
    Gregory Toomey
    Sep 27, 2003
  3. Piet L.
    Replies:
    1
    Views:
    150
    Brian McCauley
    Feb 24, 2005
  4. Replies:
    3
    Views:
    689
    alpha_beta_release
    Aug 24, 2006
  5. Ken
    Replies:
    13
    Views:
    1,027
Loading...

Share This Page