exec(),system() not working in safe_mode_exec_dir

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
leeps
Forum Newbie
Posts: 3
Joined: Thu May 08, 2003 2:06 pm

exec(),system() not working in safe_mode_exec_dir

Post 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
User avatar
Heavy
Forum Contributor
Posts: 478
Joined: Sun Sep 22, 2002 7:36 am
Location: Viksjöfors, Hälsingland, Sweden
Contact:

Post 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?
leeps
Forum Newbie
Posts: 3
Joined: Thu May 08, 2003 2:06 pm

Post by leeps »

Heavy wrote:I had to use the full path to access mysqldump.
Have you tried that?
yes. i does not work :(
Tubbietoeter
Forum Contributor
Posts: 149
Joined: Fri Mar 14, 2003 2:41 am
Location: Germany

Post 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.
leeps
Forum Newbie
Posts: 3
Joined: Thu May 08, 2003 2:06 pm

Post 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
Tubbietoeter
Forum Contributor
Posts: 149
Joined: Fri Mar 14, 2003 2:41 am
Location: Germany

Post by Tubbietoeter »

Hm thats weird, post your code here, you probably had an error in your code.
Post Reply