My cronjob is not working?

Maybe a stupid question, but I'm trying to get a cronjob to work. Although this may be a question for serverfault, I think this is also an SO question.

In any case: I installed a cronjob that will be executed every day for 1 minute of every hour, day (day), day (name) and month. This command: /home/easybr01/domains/easybranding.nl/public_html/cronjobs/test.php

This is nothing more than a file with the simpe function php mail(to, subj, content, hdrs) to check if it works ... but the letters never arrive .. and they are not in the spam exterminator folder.

Does anyone know what happened? I thought it should be pretty straight forward ...

+7
php cron
source share
2 answers

You must specify $ {PATH_TO_PHP} in a cronjob, for example: -

 * * * * * ${PATH_TO_PHP} /home/easybr01/domains/easybranding.nl/public_html/cronjobs/test.php 

Alternatively, you can make an executable script (e.g. mod 744),
and put #!${PATH_TO_PHP} in the first line of your PHP script, for example: -

 #!${PATH_TO_PHP} <?php // remanding code ?> 
+5
source share

First you need to run the PHP command line interpreter, not just point to the PHP file. If you give the cron command, it needs a whole command.

+4
source share

All Articles