Reputation: 4827
I have a question about what command to use to run a PHP script from Crontab.
Which of these alternatives would be the most appropriate to use.
* * * * * /usr/bin/php /var/www/project/cron.php
* * * * * /usr/bin/curl --silent --compressed http://localhost/project/cron.php
* * * * * /usr/bin/wget http://localhost/project/cron.php
I hope not to bother with my question. Thanks.
Upvotes: 4
Views: 7907
Reputation: 19573
Use the first option. When you are running scripts via console, running them directly is always a better idea. Running it via web server can introduce unexpected problems with reliability.
Upvotes: 0
Reputation: 490597
If it's a PHP script you want to run, in a CLI environment, I'd definitely use php
.
If you want to run the PHP script in a server environment, use either wget
or curl
, but I'd argue that a process task like this should be executed on the CLI.
Upvotes: 2