Invalid crontab

software development


Hi, i just tried to setup my first cronjob and I failed miserably.
My Goal: To run a php script every 30 minutes.
My attempt was as folows.

  1. vi foo
    MAILTO: myemailaddress
    */30 * * * * php /home/myusername/

install cron

  1. crontab foo

Now I get an email stating this.

I used this cron on my previous shared server without a problem. I also tried running it as a shell script whatever by putting #!/usr/local/bin/php -q on top of my php script, chmodding it to 755 and then just doing */30 * * * * /fullpath/script.php, but that doesn’t work either.

2 questions.

  1. How can I get this working?
  2. If i didn’t put MAILTO on the cron, what email does the system to use and how do I change or modify that?

Oh, and running php script.php from the shell runs perfect…Must have something to do with this server clustering which confuses the hell out of me.


Make sure you have a blank line after the crontab line in your text file foo. I.E. Press return twice.

You may want to try the full path for php



Excellent, that was it. Thanks norm.

Do you happen to know the answer to my other question? About where I can find and modify my email address for my *nix user account?


I am not too sure what you mean here. But if you mean the username that you use to login, for example with ssh, to the account then that is fixed.



If you don’t specify a mailto address, messages will be sent to that user’s maildir. So, if you set up an E-mail address in conjunction with the user (through the panel) who’s got the cronjobs then you’ll recieve the messages normally. If there’s no E-mail address set up with the user, it will still be delivered to the maildir, you’ll just have to use SSH to access it.

I think that you can specify any dreamhost address as the mailto address as well…



I’m having the exact same problem and (what with me being very new to shell commands) I have no idea what it means to use the full path… /usr/local/bin/php

My crontab currently looks like:

*/30 * * * * php /home/username/userdomain/folder/script.php

Does this mean that it should look like this?

*/30 * * * * php /username/local/bin/php/script.php


Instead of:-

*/30 * * * * php /home/username/userdomain/folder/script.php


*/30 * * * * /usr/local/bin/php /home/username/userdomain/folder/script.php

(all on one line with at least one space between /usr/local/bin/php and /home/username/userdomain/folder/script.php)

php is the ‘executable’ part and cron needs to know that it is in the folder /usr/local/bin/ which is the ‘path’.

So when a program asks for the full path it means to add the exact route to the location of the program or script on a particular computer.