Mohdows Mohdows - 1 month ago 6
PHP Question

What is the differance between CURL, WGET and PHP Cronjob

I am trying to create a cronjob and I don't know what is the difference between those lines, ans which one I am supposed to use to make the Cronjob work correctly.

0 0 * * * /usr/bin/php5.5 /website/cron.php
0 0 * * * /usr/bin/curl /website/cron.php
0 0 * * * /usr/bin/wget /website/cron.php


Now I need to know which one works, I am sure that my server has the CURL and WGET installed by using the commande line:

whereis wget
whereis curl


But when I tried creating a simple php file to send me emails only this code worked for me:

0 0 * * * /usr/bin/php5.5 /website/cron.php


So what to do?

Answer

curl and wget are supposed to send a http request(like downloading files/ post data etc.)

cron.php is a php file. You should always use php (whatever version) to execute it.

That's why only 0 0 * * * /usr/bin/php5.5 /website/cron.php worked.

If you really want to use curl or wget, here is an example:

0 0 * * * /usr/bin/curl --silent http://youwebsite.com/cron.php &>/dev/null