Cronjob Problem Plzzz Help


I have a php file that has a simple code to send goodmorning email to a mail id. the file sends goodmorning mail whenever i visit it through web browser. now i want to put it in cronjob so that it sends goodmorning mail every 30 minutes. i have written

30 * * * * /usr/local/bin/php /home/username/

as my cronjob entry. yet it is not sending me any mail. i have even added
#!/usr/local/bin/php -q

in my php file. am not getting any error mail also. plz help


That other thread you posted in did have a suggestion to try the following syntax:

If you’re using the panel to enter the cronjob, you don’t need the 30 * * * *, so I’m hoping you did this via crontab -e on the command line.



sorry 2 bother u again but am using crontab -e command. i don’t have access to anything else. am writing

30 * * * * /usr/bin/curl -s -o /dev/null

in my crontab. the file works fine when i execute it using browser or using command line but whn i write this in crontab, it is not working. plzzzz help me…


30 * * * * curl -s -O


Thanx for the reply but this one also didn’t work… what should i do ?


Being nosy, I typed it into my browser and got a “Mission Accomplished” page.

30 * * * * /usr/bin/curl

It may dump results in your mailbox, but at least you’ll know it’s working. I tried it from command line, and it does work. Make sure to use full path for curl.



thanx 4 the reply, yes i got the mail i.e. output of the send.php as am a beginer , i would be thankfull if you could plz let me know how to find out “full path for curl” ? & am not getting any mails in my mailbox


Full path is /usr/bin/curl
To find out, type ‘which curl’ on the command line.



Thanx scott for that reply but the problem remains the same now my entry in crontab looks like

30 * * * * /usr/bin/curl

but it still won’t work. what else can i try ?


as suggested futher up the thread, it should be

30 * * * * /usr/bin/curl -s -o /dev/null
Alternatively in the panel, go to cron jobs, and enter

/usr/bin/curl -s -o /dev/null
If that doesn’t work, it’s likely to be your code that’s broken… try attaching debug vars, catching errors, and emailing the result to yourself via the mail() function (pass or fail with errors).


web design, development & seo by DigitalVibe

<?php $mail = '****@****.com'; $sendto = '*****@****.com'; $msg = "Good Morning"; if(mail($sendto, $subject, $msg, "From: $mail")) { echo "Mission Accomplishd"; } else { echo"OOPS Application made a POO POO"; } ?>

this is the code written in send.php file


I presume there’s more in the send.php file?

  • Subject has no value according to that code snippet.

  • I meaning that if there was code at work somewhere before it sends the mail, then to trap errors in that block of code and email you a report saying there was a problem.

  • An “echo” is useless if you’re running a cron job like that because you’re never going to see the resulting success/fail message… it needs to mail() you the error.


web design, development & seo by DigitalVibe


*/30 * * * * /usr/bin/curl -s 1>&2 &>/dev/null ________________________
[color=#00CC00] _ _| _ _ _ _|_ _ (_|_\|<(_||_)(_|(_| |(/_ | [/color]


My example should be working already though (i use it on several domains already), which is why i’m suspecting it might be a php code error.

All we know is that “it doesn’t work”. We don’t know any more, so hopefully if the eu can get some sort of debug script together, we can see why it’s failing.


web design, development & seo by DigitalVibe


I concur. There’s nothing wrong with digital’s cronjob.

These all work via cron as well:

30 * * * * curl -s -O ~ Will run and NOT bug you with a cron msg mail : See here

30 * * * * curl -s ~ Will run AND WILL bug you with a cron msg mail

30 * * * * curl ~ Will run AND WILL bug you with a cron msg mail

I find /usr/bin/ directives are unnecessary when calling curl.


Maybe the problem is occurring because of a bad php configuration or handler on the, maybe an old php, maybe an old apache 1.3 handler.

execute it directly with php5:

30 * * * * /dh/cgi-system/php5.cgi /home/user/ 1>&2 &>/dev/null _____
[color=#00CC00] _ _| _ _ _ _|_ _ (_|_\|<(_||_)(_|(_| |(/_ | [/color]


believe me tis is the only code written in my send.php file & it works fine. am a beginer & would appritiate if you can repair, edit or modify the code of send.php & suggest me the entry in crontab file


I used your send.php (with my email address) and inserted this line:

30 * * * * curl -s -O

I received an email at 30 minutes after the hour, every hour.

I don’t know what else to tell you mate. Maybe you’re not waiting long enough to witness the response of the cronjob before considering it failed and changing it? If it’s impatience getting in the way, change 30 to */5 for a quicker test result (5 minutes).

Remember to change it back to 30 or */30 later tho.


30 * * * * /usr/bin/curl -s -o /dev/null
30 * * * * /usr/bin/curl -s -O
30 * * * * /usr/bin/curl -s
30 * * * * /usr/bin/curl
30 * * * * curl -s -O
30 * * * * /usr/bin/curl -s -O

none of them is working. even replacing 30 with 5 is also not working. the crontab entries are given above & the php code am using is given above.

is there any other problem with my setup or any permission is required?


I believe you’ll need to ask support to take a look at the server config for you. Give them as much information as you can, even link to this thread.

Do let us know how you get on, this is an interesting problem.