I have been wondering, is there a difference between wget [parameters], curl [parameters] and php [parameters] whilst creating a cron job?
If I have a script “cron-00-00.php” and I need to run it what would each of the mentioned above do?
0 0 * * * php -q /your_abolute_path/includes/php/cron/cron-00-00.php >/dev/null 2>&1
0 0 * * * wget -O - -q -t 1 http://your_domain_com/includes/php/cron/cron-00-00.php >/dev/null 2>&1
0 0 * * * curl http://your_domain_com/includes/php/cron/cron-00-00.php
Or is it optional to use either one(depending upon the one that best suits me)?
I currently have this thought that the 3 of them have different functions. Please correct my conceptions.
Running PHP directly is the simplest option. It doesn’t take up a network slot on your apache (or other webserver) instance. It also bypasses limits associated with webservers that are designed to protect your machine against malicious third parties. However, the environment under which the command-line version of PHP runs is slightly different, and may be enough so to prevent a poorly-written script from behaving properly. Also, some webserver run PHP as a DSO module within apache’s process space and using apache’s user permissions. This might affect your results (maybe positively or maybe negatively).
Of the remaining two options,
curlseems to be slightly more widely deployed thanwget, so that would be my second choice, though they’re approximately equal.