Cron and PHP file not running

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
Addos
Forum Contributor
Posts: 305
Joined: Mon Jan 17, 2005 4:13 pm

Cron and PHP file not running

Post by Addos »

Hi,
I’m trying to run a small test using Cron through Direct Admin. I have been at this for ages and just can’t seem to get a result.

In DirectAdmin I have set the Cron Job to run every minute. (this is purely for testing until I know it’s working as I understand doing this uses up resources) The path I’m using is /usr/local/bin/php /home/bftest/mail_test.php and the mail.test.php file contains the info below. I’m expecting to get an email every minute if the Cron job is working but I’m not getting anything at all, not even an error. Can anyone give me a few pointers as to what I might be doing wrong? I have searched the net for info especially on the command path as I suspect that this might be the problem but there are various paths discussed and I feel like I’ve tried them all. Should I just set up a Cron Job in a separate php file and upload this by passing DirectAdmin?

Does anyone even have a test script that I can run to try and see if my Cron facility is working to at least eliminate some of this problem?
Thanks

Code: Select all

<?PHP 
    $from = 'Me' . "\r\n";
    $subject = 'Message from your website' . "\r\n";
    $headers = "To: info@blah1.com,info@blah2.com \r\n";
 
    $headers .= "from: $from\n";
    
    $message =  "testing email using Cron  ". "\r\n";
 
  mail($to,$subject,$message,$headers); 
  ?>
Post Reply