Page 1 of 1
running linux command under php
Posted: Wed Oct 29, 2003 9:53 am
by scubadiveflorida
I was wondering what commands you use to run linux commands under php. Like for instance say I wanted to go into the root directory and create a new directory then go to that directory and create a new file there. How would I do that? Thanks.
Posted: Wed Oct 29, 2003 10:00 am
by scorphus
Take a look to these sections of the PHP Manual:
•
Execution Operators
•
Directory functions
•
Filesystem functions
•
Program Execution functions
Have a nice day,
Scorphus.
What am I doing wrong
Posted: Wed Oct 29, 2003 10:58 am
by scubadiveflorida
I am trying to create a directory, move into that directory the write a new file and this does not work. What am I doing wrong?
$output = `mkdir test`;
$output .= `cd test`;
$output .= `touch newfile.txt`;
Posted: Wed Oct 29, 2003 11:09 am
by scorphus
$output = `mkdir test`; will attempt to create a directory test inside the current directory.
Does the Apache's user have permission to write to this current directory?
Cheers,
Sco.
Posted: Wed Oct 29, 2003 11:28 am
by richie256
Maybe you need to execute these command separately? or add a ";" between each command?
Hope this will help!