using Exec() or shell_exec() to run sys cmds not working

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
eatrom
Forum Newbie
Posts: 15
Joined: Tue Jul 16, 2002 8:32 am
Location: White North of Minnesota

using Exec() or shell_exec() to run sys cmds not working

Post by eatrom »

example code:

<?

$command = "mv myfile.txt archive/";
$output = shell_exec("$command");
echo(nl2br($output));

?>

results in an error stating
Warning: Cannot execute using backquotes in safe mode in /home/.../test.php on line 4

Does this mean that the server is protected from executing system commands from PHP? I've tried with and without back ticks and get the same response.

What I need is to (eventually) have a php cron job that ftp's a file off another server and then processes it. But if I can't use php to exec the ftp command, and do simple things like cp and mv, then it is going to get tiring having to do these by hand each day.

:roll:

Any help??
Post Reply