Chdir doesn't work under Apache?

Ask a Question related to PERL Beginners, Design and Development.

  1. #1

    Default RE: Chdir doesn't work under Apache?


    The first three things to note:

    1) CHDIR to C: works, CHDIR to UNC paths (//server/what/the/file) cannot
    and will not. *Map a drive* or
    use it as a path (ie, direct all commands to '$directories/stuff'.

    2) Make sure the user running APACHE as a user, and not 'local system',
    and make sure that user has
    access to the mapped drive. (local system generally has less network
    permission than guest, except
    where the share has been enabled to NULL session access).
    (http://support.microsoft.com/default.aspx?scid=kb;en-us;289655)

    3) You are using CGI::Carp but not CGI, and you are not printing
    headers.

    What exactly is the error you are getting?

    -----Original Message-----
    From: Renger van Nieuwkoop [mailto:ch]
    Sent: Wednesday, 18 February 2004 12:48 AM
    To: org
    Subject: Chdir doesn't work under Apache?

    Hi

    I have a simple script that runs fine from the command line, but gives
    me an error when I run it using Apache 2.0:

    #!perl -w
    use CGI::Carp qw(fatalsToBrowser);
    use File::Find;

    # get a network directory
    my $directories = qw(//server/Web/database/EDV);
    chdir("$directories") || die "cannot open current directory : $!\n";

    If I use a local directory like in:
    my $directories = qw(C:/);
    the script runs fine under Apache and from the command line.

    What am I doing wrong?

    Thanks for any help.

    Renger

    PS I use Perl 5.8, Apache 2 and Windows 2000.s


    _________________________________________________

    ECOPLAN
    Forschung und Beratung in Wirtschaft und Politik Economic Research and
    Policy Consultancy

    Thunstrasse 22 / CH-3005 Berne (Switzerland)
    Phone: +41 31 356 61 61 / Fax: +41 31 356 61 60 mailto:ch
    / http://www.ecoplan.ch>


    --
    To unsubscribe, e-mail: org
    For additional commands, e-mail: org
    <http://learn.perl.org/> <http://learn.perl.org/first-response>



    David Guest

  2. Similar Questions and Discussions

    1. #39953 [Opn->Fbk]: chdir(..) not working in open_basedir where chdir(../) does !
      ID: 39953 Updated by: tony2001@php.net Reported By: zend at oliwel dot de -Status: Open +Status: ...
    2. #39953 [NEW]: chdir(..) not working in open_basedir where chdir(../) does !
      From: zend at oliwel dot de Operating system: Linux PHP version: 5.2.0 PHP Bug Type: Directory function related Bug...
    3. #38820 [NEW]: chdir(".") and chdir("..") don't work with Apache 2.0+
      From: ras at fyn dot dk Operating system: Win XP SP2 PHP version: 5.1.6 PHP Bug Type: Directory function related Bug...
    4. Getting Apache 2.x to work with Coldfusion MX 7
      I have windows 2003 server and I'm running apache 2.x and coldfusion MX 7 full CD. I used to mess around with coldfusion 6.1 trail version, and...
    5. APACHE/PHP - buttons don't work
      Hi, I've recently upgraded my webserver for apache 2.0.47 with php 4.3.2 on a solaris 9 box My problem is... the buttons on the php pages...
  3. #2

    Default AW: Chdir doesn't work under Apache?

    Thanks so much, David
    Apache was running as 'local system' and now runs with the appropriate user
    (never knew that you could run Apache in these different ways..)
    The script now runs fine.
    Renger

    -----Ursprungliche Nachricht-----
    Von: David le Blanc [mailto:com.au]
    Gesendet: Dienstag, 17. Februar 2004 15:33
    An: ch
    Cc: org
    Betreff: RE: Chdir doesn't work under Apache?



    The first three things to note:

    1) CHDIR to C: works, CHDIR to UNC paths (//server/what/the/file) cannot
    and will not. *Map a drive* or
    use it as a path (ie, direct all commands to '$directories/stuff'.

    2) Make sure the user running APACHE as a user, and not 'local system',
    and make sure that user has
    access to the mapped drive. (local system generally has less network
    permission than guest, except
    where the share has been enabled to NULL session access).
    (http://support.microsoft.com/default.aspx?scid=kb;en-us;289655)

    3) You are using CGI::Carp but not CGI, and you are not printing
    headers.

    What exactly is the error you are getting?

    -----Original Message-----
    From: Renger van Nieuwkoop [mailto:ch]
    Sent: Wednesday, 18 February 2004 12:48 AM
    To: org
    Subject: Chdir doesn't work under Apache?

    Hi

    I have a simple script that runs fine from the command line, but gives
    me an error when I run it using Apache 2.0:

    #!perl -w
    use CGI::Carp qw(fatalsToBrowser);
    use File::Find;

    # get a network directory
    my $directories = qw(//server/Web/database/EDV);
    chdir("$directories") || die "cannot open current directory : $!\n";

    If I use a local directory like in:
    my $directories = qw(C:/);
    the script runs fine under Apache and from the command line.

    What am I doing wrong?

    Thanks for any help.

    Renger

    PS I use Perl 5.8, Apache 2 and Windows 2000.s


    _________________________________________________

    ECOPLAN
    Forschung und Beratung in Wirtschaft und Politik Economic Research and
    Policy Consultancy

    Thunstrasse 22 / CH-3005 Berne (Switzerland)
    Phone: +41 31 356 61 61 / Fax: +41 31 356 61 60 mailto:ch
    / http://www.ecoplan.ch>


    --
    To unsubscribe, e-mail: org
    For additional commands, e-mail: org
    <http://learn.perl.org/> <http://learn.perl.org/first-response>


    Renger Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139