php shell_exec($cmd) do not run in a cronjob

自作多情 提交于 2019-12-10 11:43:14


sorry for that (I believe) poor question, but google and other articles in this forum can't help me...

I'll run the a php script with following code in it:

    $cmd="duck  -u user_name -p pwd -parallel 1 -e overwrite -y --throttle 1024 --upload path to remote file absolute_path_to_local_file";

This works well, when I call this php file in the browser. But it fails, when I call the script within a cronjob.

With a cronjob i get following errormessage:

sh:1: duck not found

I believe this can be a permissions problem, but I'm new in this area and do not know where I can set the permissions and what I have to do.

Can anybody please help me?!


Cron jobs do not get the normal PATH env variable that is usually available.

Try using the absolute path for the 'duck' command instead.


$cmd = "/usr/bin/duck ..."

To find the absolute path, you can type

which duck

on a normal command prompt