Search code examples
laravelshared-hosting

Hi, I am having trouble with running my Laravel Cron job on shared hosting "hostinger"


my Cron job works fine on localhost but it doesn't work on shared hosting and it doesn't return any error or something. this how I'm calling my Cron job: php /path_to_my_project/public_html/myproject artisan queue:work my queue driver is database and here's my code:

ChangePassword::dispatch($user)->delay(now()->endOfMinute()->addMinutes(1));

Solution

  • Your cron command needs to be more like;

    /usr/local/bin/php /path_to_my_project/public_html/myproject/artisan queue:work
    

    if you have console access type which php to check the path of php

    WARNING: check that your .env file is not vulnerable since you put your project inside public_html