Page 1 of 1

exec(),system() not working in safe_mode_exec_dir

Posted: Thu May 08, 2003 2:06 pm
by leeps
hi everyone,

i want to run the shell-command 'uptime' from my index.php. but i cannot get the output of 'uptime' back to php. i tried running a script without uptime, but it writes something to some file. however the file never gets created, so i guess the command is never executed from the php-script.
i have safe_mode on and copied /bin/uptime to my safe_mode_exec_dir. i don't get any errors, neither on the page-output, nor in php.error.log, even when logging E_ALL.

php-version and variables can be seen from http://mainframe.frontbone.de/phpinfo.php

please advise me with anything! i really don't know what to do about this... it looks like my php doesn't like me... i code php for about 1.5years, two friends of mine also looked at it, they code even longer than me... please, just anything :)

greetings,

sebastian

Posted: Thu May 08, 2003 3:38 pm
by Heavy
I just posted the fourth reply to this topic:
viewtopic.php?t=8591

...where I discovered that I had to use the full path to access mysqldump.
Have you tried that?

Posted: Thu May 08, 2003 3:42 pm
by leeps
Heavy wrote:I had to use the full path to access mysqldump.
Have you tried that?
yes. i does not work :(

Posted: Fri May 09, 2003 1:22 am
by Tubbietoeter
try to use shell_exec (see description at php.net); this one gives you the output of the script called.


also check if everybody has execution rights on the script. output the command before you execute it and try if it works directly in a shell.

Posted: Fri May 09, 2003 2:35 am
by leeps
tried that. now way.


but i found out that i can run '/save/mode/exec/dir/echo test' with system() - it's odd, but after writing a shell-script with my commands, which needs only one paramater, it began working.

thank all who have replied and also others who could think of something.

sebastian

Posted: Fri May 09, 2003 2:58 am
by Tubbietoeter
Hm thats weird, post your code here, you probably had an error in your code.