Crontab command is giving error


i am setting following command in my crontab list.

30 * * * * php -q $HOME/website/test/myTest.php

And when cron process runs it, i am getting an email from daemon saying following error occured.!! Is there any problem? Can somebody help me?

/bin/sh: line 1: php: command not found


Jigar Mehta

You need to include the full path to php.

As the other poster mentioned, you’ll need to include PHP’s full path. It should look like:
30 * * * * /usr/local/bin/php -q $HOME/website/test/myTest.php

I suggest you run the entire command manually first just to see if it works, then let cron run it from then on.



Giving full path on the crontab file solved the problem.

BTW, i tried running my old command on the shell without /usr… and it was working… but seems like from inside the crontab task file, we need to have full path!!

Anyways, thanks both of you for your help. DH forum is rocking!! Instant reply to all questions !!

Jigar Mehta