ryy705 Posted August 20, 2008 Share Posted August 20, 2008 Hello, I am trying to use cron to send out emails from my site. Here is what I put in my crontab: [email protected] */5 * * * * /absolute/path/test.php And here is whats in test.php: <?php mail('[email protected]','subject','message'); ?> test.php is set to 777. But cron is running every five minutes but its failing to execute the php file and sending me error messages. I'll post them below: /absolute/path/test.php: line 1: ?php: No such file or directory /absolute/path/test.php: line 2: syntax error near unexpected token `'[email protected]','subject','message'' /absolute/path/test.php: line 2: `mail('[email protected]','subject','message');' I have tried this in two different webhosts and got the same result. Any input and help would be appreciated. Thank you. Link to comment https://forums.phpfreaks.com/topic/120574-solved-help-with-cron/ Share on other sites More sharing options...
Jabop Posted August 20, 2008 Share Posted August 20, 2008 * * * * * php /dir/file.php Link to comment https://forums.phpfreaks.com/topic/120574-solved-help-with-cron/#findComment-621329 Share on other sites More sharing options...
ryy705 Posted August 20, 2008 Author Share Posted August 20, 2008 Thank you. I will try it and respond after 5 min. Thank you again. Link to comment https://forums.phpfreaks.com/topic/120574-solved-help-with-cron/#findComment-621333 Share on other sites More sharing options...
trq Posted August 20, 2008 Share Posted August 20, 2008 Should be... */5 * * * * /usr/bin/php /absolute/path/test.php Cron doesn't have much of an environment. Link to comment https://forums.phpfreaks.com/topic/120574-solved-help-with-cron/#findComment-621342 Share on other sites More sharing options...
ryy705 Posted August 20, 2008 Author Share Posted August 20, 2008 Thank you it worked Link to comment https://forums.phpfreaks.com/topic/120574-solved-help-with-cron/#findComment-621345 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.