Page 1 of 1
system(), exec(), etc.
Posted: Wed Jul 16, 2003 2:39 pm
by joshw99
I am having trouble getting any of the system commands working (including the backticks even when I do just a simple 'ls' command). I have checked the safe_mode settings and they are off. The only thing I can think of, is that these commands only work if the creater of the script is root (although I doubt this is the case). Any help would be greatly appreciated!
Posted: Wed Jul 16, 2003 2:44 pm
by Stoker
What os?
any errors/warnings?
if linux or unix try echo `env 2&>1`;
Posted: Wed Jul 16, 2003 2:45 pm
by Stoker
btw, also try with full path, ENV may be cleared.... exec('/bin/ls');
Posted: Wed Jul 16, 2003 2:51 pm
by joshw99
I am using redhat 7.3
Thanks for the help (and quick response!). it seems that the ENV variables have been cleared, as /bin/ls did work. I am going to retry what I was trying to do with a full path! Thanks again
Posted: Wed Jul 16, 2003 3:15 pm
by joshw99
I tried a few things (some things worked some didn't). Ultimately I want a couple things to work:
1) I want to be able to create and delete directories (both of which don't work right now). However, this can be done using the mkdir() and rmdir() functions within php, so this isn't such a big problem.
2) I want to run a script that has execute permissions for all. I tried running it and it won't work, and I am not sure why (I did and 'or die()' statement on the system command and it did in fact die so I know it isn't running)
Posted: Wed Jul 16, 2003 3:39 pm
by Stoker
or die is based on the return of the statement ahead, if that one retruns nothing, as many unix/gnu tools do, it will die.. if you include the 2&>1 after the command it will capture STDERR and include that in the output..