What is Cron
Cron is a Linux utility which schedules a command or script on your server to run automatically at a specified time and date. Cron will help your application to process the job queues (example: emails) and perform the repeated tasks like creating recurring invoice, auto updating status of invoice, estimate etc and reminding users of different events at specified time.
Setting up Cron
You need to setup only one cron for the entire application. Method of setting up a Cron can be different based on your hosting provider. But generally this is how you setup your cron.
At first, login to your cpanel and navigate to Cron Setup page and configure the settings like following
- Change the
path-to-your-project/
part with your proper value - Make sure your cron is running on the correct PHP version. Sometimes your cron may run on top of different PHP version than what your project is running on, therefore please be aware of that.
If your server’s default PHP version is different from the required PHP version of the application, it is most likely that you need to specifically mention the required version of PHP in the command like following:
/opt/php71/bin/php /home/your_domain/path_to_project/artisan schedule:run >> /dev/null 2>&1