I try to create a cron job in my hosting on godaddy but this cron didn't send any email yet.
that how i did the cron job:
1-login into my account in godaddy.com
2-go to cpanel
3-enter in cron job
4-on add new cron job Common Settings i select each minute
5- Command :i put like this: /usr/local/bin/php -q/home/username/public_html/testcron.php
The code in testcron.php this is:
$to="email address";
$from="auto_responder@webinstrect.com";
$subject='Testing Cron';
$message='<h2>Cron is working remove test cron job now.</h2>';
$headers="From:$from\n";
$headers .="MINE-Version:1.0\n";
$headers .="Content-type:text/html;charset=iso-8859-1\n";
mail($to,$subject,$message,$headers);
I test this page alone without a cron i receive an email in my junk folder
also i tired to write the Command like this: home/username/public_html/testcron.php
The problem that i didn't receive any email. Any suggestion to solve this problem ?!!
Did you try running your command ( usr/local/bin/php -q/home/username/public_html/testcron.php
) from the terminal? There doesn't seem to be anything wrong with what you're doing ( except for that there's no space between -q and /home in your command)
cron
"At every minute"
Minute Hour Day Month Weekday Command
1 * * * * php /home/username/public_html/testcron.php
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.