jeudi 7 mars 2019

How to run artisan command schedule:run on "hostgator shared" hosting server? (Laravel 5.7)

I have been trying for 2 days to set up a laravel command on hostgator shared hosting. I contacted with their support team but they are not giving coding issue support. They said that i can set up min 15 mins cron on their shared hosting. But i tested a cron that run in every 1 min: (for testing perpose)

*/1     *   *   *   *   php -q /home1/username/mydomain.com/cron.php

In that cron.php i wrote:

    <?php
$file = "cron.html";
if (!unlink($file))
  {
  echo ("Error deleting $file");
  }
else
  {
  echo ("Deleted $file");
  }

?> 

This cron successfully deleted cron.html file if found in every min. This test is success but i can't run cron on another domain where my laravel 5.7 app is present.

I tested my code on local: When i run php artisan php artisan schedule:run , it run on local successfully.

I want to run migration on hostgator shared hosting. That's why i changed console/kernel.php file :

protected function schedule(Schedule $schedule)
{

    \Log::info('cron worked');

    // $schedule->command('inspire')
    //          ->hourly();



    $schedule->command('migrate')
        ->everyMinute();
}

And i tried few cron on hostgator:

*/1     *   *   *   * 

/usr/bin/php /var/www/home1/username/domain.com/artisan schedule:run

/usr/local/bin/php  /home1/fawel/eduworld.com.bd/artisan schedule:run >> /dev/null 2>&1

Also tried following this article:

Please provide me your tested solution if you do this on hostgator shared hosting.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire