system commands

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • yawnmoth

    system commands

    i'm running the following php script, and where i would expect it to
    create a file, test.txt, it doesn't. it isn't in the directory i am
    exectuting the script in, nor can i do cat on it (not that i would
    expect to, since it doesn't exist, heh):

    <?php

    print system("ls > test.txt");

    print system("cat ls.txt");

    ?>
  • Chris Morris

    #2
    Re: system commands

    yawnmoth <terra1024@yaho o.com> writes:[color=blue]
    > i'm running the following php script, and where i would expect it to
    > create a file, test.txt, it doesn't. it isn't in the directory i am
    > exectuting the script in, nor can i do cat on it (not that i would
    > expect to, since it doesn't exist, heh):
    >
    > <?php
    >
    > print system("ls > test.txt");
    >
    > print system("cat ls.txt");[/color]

    cat test.txt, surely?
    [color=blue]
    > ?>[/color]

    Is safe mode enabled? If so, is there an ls and a cat program in the
    safe_mode_exec_ dir?

    --
    Chris

    Comment

    • yawnmoth

      #3
      Re: system commands

      On 13 Aug 2003 10:16:56 +0100, Chris Morris <c.i.morris@dur ham.ac.uk>
      wrote:
      [color=blue]
      >yawnmoth <terra1024@yaho o.com> writes:[color=green]
      >> i'm running the following php script, and where i would expect it to
      >> create a file, test.txt, it doesn't. it isn't in the directory i am
      >> exectuting the script in, nor can i do cat on it (not that i would
      >> expect to, since it doesn't exist, heh):
      >>
      >> <?php
      >>
      >> print system("ls > test.txt");
      >>
      >> print system("cat ls.txt");[/color]
      >
      >cat test.txt, surely?[/color]

      hehe - that was the problem :)

      however, that doesn't help me solve the problem i was hoping it would
      solve :(

      if that works, then why doesn't this work?:

      <?php

      system("mysqldu mp --opt -u $dbuser --password=$dbpas swd $dbname |
      gzip > $dbname" . ".gz");

      print "<a href=\"$dbname" . ".gz\">Down load backup</a>";

      ?>

      ls > test.txt outputted to the directory the php script was in (as i
      would expect it to), so why doesn't that? i can't find that file
      anywhere, and when i run the mysqldump command through the command
      line, it works just fine...

      Comment

      Working...