Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

davy_yg's avatar
Level 27

Setting cron job

Hello,

I am trying to set cron job -

https://www.youtube.com/watch?v=jlCWLlLYEDc

I cannot understand do you set the time schedule on Kernel.php, on web hosting or both? If both, which one will the program follows?

Another thing, can you set up the time schedule by inputing the day and time through forms? If so, how to ? Should I pull the time schedule from the database and translate the codes to cron job codes?

Thanks in advance.

0 likes
1 reply
lostdreamer_nl's avatar

in your webhosting, you only set 1 cronjob.

It should call the scheduler once every minute: https://laravel.com/docs/5.7/scheduling

* * * * * cd /path-to-your-project && php artisan schedule:run >> /dev/null 2>&1

This will then call your laravel project every minute.

After that, in your kernel.php, you can set up tasks to start at any time of the day, or at any interval. You do not have to put in any more cronjobs in your server, you only have to add them to your code.

Please or to participate in this conversation.